Skip to content
Snippets Groups Projects
Commit f62523737dcd authored by Tony Garnock-Jones's avatar Tony Garnock-Jones
Browse files

Avoid hanging forever when the socket goes away and the only thing we're doing is writing.

If the connection closed during a flush_outbound with pending data, we
were in some cases (asyncore-based) looping forever. Checking each
time we enter the loop gets us a sensible exception in these cases.
parent 3336aee3ea21
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,7 @@
from heapq import heappush, heappop
from errno import EAGAIN
import pika.connection
from pika.exceptions import *
class RabbitDispatcher(asyncore.dispatcher):
def __init__(self, connection):
......@@ -108,6 +109,9 @@
def flush_outbound(self):
while self.outbound_buffer:
if self.connection_close:
# The connection was closed while we weren't looking!
raise ConnectionClosed(self.connection_close)
self.drain_events()
def drain_events(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment