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 <daniel@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Tested-by: Gonzalo Odiard <gonzalo@laptop.org>
Tested-by: Simon Schampijer <simon@laptop.org>
This commit is contained in:
Daniel Drake 2011-06-28 23:01:12 +01:00 committed by Simon Schampijer
parent 7e61237c8f
commit 10580fc2a7

View File

@ -75,6 +75,12 @@ class GlibTCPServer(SocketServer.TCPServer):
# let the request be closed by the request handler when its done # let the request be closed by the request handler when its done
pass 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): class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""RequestHandler class that integrates with Glib mainloop. It writes """RequestHandler class that integrates with Glib mainloop. It writes