mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 05:02:33 +01:00
Irc: don't abort on BlockingIOError, ssl.SSLWantReadError, ssl.SSLWantWriteError
This effectively merges in the following 2.0 commits: - "IRCNetwork: do not break on socket BlockingIOError"6a90e99de4
- "IRCNetwork: also catch ssl.SSLWantReadError and ssl.SSLWantWriteError"ccc9f8e5c8
- "IRCNetwork: bump SOCKET_REPOLL_WAIT to 1 sec"92460716d1
This fixes one part of #463.
This commit is contained in:
parent
c54bb557dd
commit
58e6527719
@ -36,6 +36,7 @@ class ProtocolError(RuntimeError):
|
||||
|
||||
class Irc(utils.DeprecatedAttributesObject):
|
||||
"""Base IRC object for PyLink."""
|
||||
SOCKET_REPOLL_WAIT = 1.0
|
||||
|
||||
def __init__(self, netname, proto, conf):
|
||||
"""
|
||||
@ -433,9 +434,13 @@ class Irc(utils.DeprecatedAttributesObject):
|
||||
buf = b""
|
||||
data = b""
|
||||
while not self.aborted.is_set():
|
||||
|
||||
try:
|
||||
data = self.socket.recv(2048)
|
||||
except (BlockingIOError, ssl.SSLWantReadError, ssl.SSLWantWriteError):
|
||||
log.debug('(%s) No data to read, trying again later...', self.name)
|
||||
if self.aborted.wait(self.SOCKET_REPOLL_WAIT):
|
||||
return
|
||||
continue
|
||||
except OSError:
|
||||
# Suppress socket read warnings from lingering recv() calls if
|
||||
# we've been told to shutdown.
|
||||
|
Loading…
Reference in New Issue
Block a user