3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

classes: Don't require self.connected to be set for "No data received" disconnects

Previously, this would've caused an infinite loop if a socket closed (e.g. from server shutdown) while PyLink was connecting.
This commit is contained in:
James Lu 2015-12-29 11:23:06 -08:00
parent 9556efae46
commit 91f75e4d93

View File

@ -310,8 +310,8 @@ class Irc():
while not self.aborted.is_set(): while not self.aborted.is_set():
data = self.socket.recv(2048) data = self.socket.recv(2048)
buf += data buf += data
if self.connected.is_set() and not data: if not data:
log.warning('(%s) No data received and self.connected is set; disconnecting!', self.name) log.warning('(%s) No data received, disconnecting!', self.name)
return return
elif (time.time() - self.lastping) > self.pingtimeout: elif (time.time() - self.lastping) > self.pingtimeout:
log.warning('(%s) Connection timed out.', self.name) log.warning('(%s) Connection timed out.', self.name)