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

IRCNetwork: try to abort immediately if the send queue is full

This commit is contained in:
James Lu 2018-10-08 16:25:53 -07:00
parent 0b3793380b
commit 60b7894cd6

View File

@ -14,6 +14,7 @@ import ssl
import hashlib
import ipaddress
import queue
QUEUE_FULL = queue.Full
import functools
import string
import re
@ -1921,7 +1922,12 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
if queue:
# XXX: we don't really know how to handle blocking queues yet, so
# it's better to not expose that yet.
self._queue.put_nowait(data)
try:
self._queue.put_nowait(data)
except QUEUE_FULL:
log.error('(%s) Max SENDQ exceeded (%s), disconnecting!', self.name, self._queue.maxsize)
self.disconnect()
raise
else:
self._send(data)