From 120f6fb7f09a25a506f9eb81e69fb7db9d969c66 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 3 Aug 2015 04:41:00 -0700 Subject: [PATCH] main: raise connect timeout, run initVars on connect and not disconnect --- main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 0451cba..f72f8e0 100755 --- a/main.py +++ b/main.py @@ -77,10 +77,11 @@ class Irc(): port = self.serverdata["port"] while True: log.info("Connecting to network %r on %s:%s", self.name, ip, port) + self.initVars() try: # Initial connection timeout is a lot smaller than the timeout after # we've connected; this is intentional. - self.socket = socket.create_connection((ip, port), timeout=1) + self.socket = socket.create_connection((ip, port), timeout=self.pingfreq) self.socket.setblocking(0) self.socket.settimeout(self.pingtimeout) self.proto.connect(self) @@ -110,8 +111,6 @@ class Irc(): except: # Socket timed out during creation; ignore pass self.callHooks([None, 'PYLINK_DISCONNECT', {}]) - # Reset all our variables - this is important! - self.initVars() def run(self): buf = b""