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

classes.Irc: when disconnecting, suppress socket read errors in run() (#152)

This commit is contained in:
James Lu 2016-01-09 20:24:46 -08:00
parent cf2fcf9263
commit 925e11d6c4

View File

@ -274,7 +274,16 @@ class Irc():
buf = b"" buf = b""
data = b"" data = b""
while not self.aborted.is_set(): while not self.aborted.is_set():
data = self.socket.recv(2048)
try:
data = self.socket.recv(2048)
except OSError:
# Suppress socket read warnings from lingering recv() calls if
# we've been told to shutdown.
if self.aborted.is_set():
return
raise
buf += data buf += data
if not data: if not data:
log.warning('(%s) No data received, disconnecting!', self.name) log.warning('(%s) No data received, disconnecting!', self.name)