Skip to content

Commit

Permalink
Add connect timeouts for peersync
Browse files Browse the repository at this point in the history
  • Loading branch information
b-i-z committed Jul 19, 2019
1 parent bf6a3e6 commit 0ebb7f8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions peershandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def peersync(self, subdata: str) -> int:
try:
# check if node is active
s_purge = socks.socksocket()
s_purge.settimeout(5)
if self.config.tor:
s_purge.setproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
s_purge.connect((pair[0], int(pair[1])))
Expand Down Expand Up @@ -340,6 +341,7 @@ def peersync(self, subdata: str) -> int:
self.app_log.info(f"Outbound: {ip}:{port} is a new peer, saving if connectible")
try:
s_purge = socks.socksocket()
s_purge.settimeout(5)
if self.config.tor:
s_purge.setproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
s_purge.connect((ip, int(port))) # save a new peer file with only active nodes
Expand Down

0 comments on commit 0ebb7f8

Please sign in to comment.