mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-25 20:29:23 +01:00
Socket: Fix hanging while TLS socket buffer is non-empty
This commit is contained in:
parent
a46a0733af
commit
58287207d7
@ -200,6 +200,13 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
"""Called by _select() when we can read data."""
|
"""Called by _select() when we can read data."""
|
||||||
try:
|
try:
|
||||||
new_data = self.conn.recv(1024)
|
new_data = self.conn.recv(1024)
|
||||||
|
if hasattr(self.conn, "pending") and self.conn.pending():
|
||||||
|
# This is a TLS socket and there are decrypted bytes in the
|
||||||
|
# buffer. We need to read them now, or we would not get them
|
||||||
|
# until the next time select() returns this socket (which may
|
||||||
|
# be in a very long time, as select() does not know recv() on
|
||||||
|
# the TLS wrapper would not block).
|
||||||
|
new_data += self.conn.recv(self.conn.pending())
|
||||||
if not new_data:
|
if not new_data:
|
||||||
# Socket was closed
|
# Socket was closed
|
||||||
self._handleSocketError(None)
|
self._handleSocketError(None)
|
||||||
|
Loading…
Reference in New Issue
Block a user