From 4d128db64ac32fb1a0a2b90c2c992648e541475f Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Sat, 28 Dec 2013 18:42:03 +0000 Subject: [PATCH] BF: asyncserver now ensures all data is sent Previously was using `send` method, which uses `socket.send`. This does not guarantee to send all data, and no check was in place to verify whether all data was sent. Using asynchat built in `push` method, ensures that all data is sent before closing the connection. --- server/asyncserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/asyncserver.py b/server/asyncserver.py index 62a5dd8b..15d49b01 100644 --- a/server/asyncserver.py +++ b/server/asyncserver.py @@ -65,7 +65,7 @@ class RequestHandler(asynchat.async_chat): # Serializes the response. message = dumps(message, HIGHEST_PROTOCOL) # Sends the response to the client. - self.send(message + RequestHandler.END_STRING) + self.push(message + RequestHandler.END_STRING) # Closes the channel. self.close_when_done()