GlibTCPServer: defer shutdown_request to avoid closing the socket too early OLPC #10906

In Python 2.7, shutdown_request was added to the BaseServer class and
TCPServer was adopted to use it instead of close_request in the
_handle_request_noblock() path.

GlibTCPServer must be adapted to account for this, so that
shutdown_request is not allowed to prematurely allowed to close the socket,
in the same way that close_request is ignored.

Fixes collaboration in activities that rely on this mechanism for
sharing (including ImageViewer and Read)

Signed-off-by: Daniel Drake <[email protected]>
Acked-by: Simon Schampijer <[email protected]>
Tested-by: Gonzalo Odiard <[email protected]>
Tested-by: Simon Schampijer <[email protected]>
This commit is contained in:
Daniel Drake
2011-06-29 14:42:53 +02:00
committed by Simon Schampijer
parent 7e61237c8f
commit 10580fc2a7
+6
View File
@@ -75,6 +75,12 @@ class GlibTCPServer(SocketServer.TCPServer):
# let the request be closed by the request handler when its done
pass
def shutdown_request(self, request):
"""Called to shutdown and close an individual request."""
# like close_request, let the request be closed by the request handler
# when done
pass
class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""RequestHandler class that integrates with Glib mainloop. It writes