From 0ebb7f8a4d636fe5e23126b6ad49a56c0cc2277e Mon Sep 17 00:00:00 2001 From: b-i-z <50231809+b-i-z@users.noreply.github.com> Date: Fri, 19 Jul 2019 20:38:36 +0100 Subject: [PATCH] Add connect timeouts for peersync --- peershandler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/peershandler.py b/peershandler.py index 53cc7f5..5fb16e4 100644 --- a/peershandler.py +++ b/peershandler.py @@ -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]))) @@ -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