Skip to content

Commit

Permalink
_websocket_handler waits on writer even after the socket is closed
Browse files Browse the repository at this point in the history
This patch wakes up the writer with a null message when the socket gets closed
  • Loading branch information
babu-shanmugam committed Dec 13, 2015
1 parent 1e0da30 commit 0c439be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engineio/socket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import absolute_import
import time
import six
import socket

from . import packet
from . import payload
Expand Down Expand Up @@ -150,7 +152,7 @@ def writer():
try:
for pkt in packets:
ws.send(pkt.encode(always_bytes=False))
except:
except socket.error:
break

writer_task = self.server.start_background_task(writer)
Expand All @@ -173,4 +175,5 @@ def writer():
except ValueError:
pass
self.close(wait=False, abort=True)
self.queue.put(packet.Packet(packet.NOOP)) # wakeup the writer
writer_task.join()

0 comments on commit 0c439be

Please sign in to comment.