WebSocket.send fix for big data

on slow internet connections the send command fails sometimes to send all the data in one packet. then the websocket connection is out of sync and get's interrupted.
This commit is contained in:
nashim
2013-03-03 01:01:56 +01:00
parent 90db4a9bcb
commit a62f2ccff0

View File

@@ -518,7 +518,9 @@ class WebSocket(object):
if self.get_mask_key:
frame.get_mask_key = self.get_mask_key
data = frame.format()
self.io_sock.send(data)
while data:
l = self.io_sock.send(data)
data = data[l:]
if traceEnabled:
logger.debug("send: " + repr(data))