mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
main: raise connect timeout, run initVars on connect and not disconnect
This commit is contained in:
parent
58e84a654c
commit
120f6fb7f0
5
main.py
5
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""
|
||||
|
Loading…
Reference in New Issue
Block a user