t.daemon = True
t.start()
- def handle_request(self, c):
- '''
- Handle a new connection
- '''
- funcname = result = request = None
+ def _handle_request(self, c):
+ request = None
try:
connection.deliver_challenge(c, self.authkey)
connection.answer_challenge(c, self.authkey)
msg = ('#TRACEBACK', format_exc())
else:
msg = ('#RETURN', result)
+
try:
c.send(msg)
except Exception as e:
util.info(' ... request was %r', request)
util.info(' ... exception was %r', e)
- c.close()
+ def handle_request(self, conn):
+ '''
+ Handle a new connection
+ '''
+ try:
+ self._handle_request(conn)
+ except SystemExit:
+ # Server.serve_client() calls sys.exit(0) on EOF
+ pass
+ finally:
+ conn.close()
def serve_client(self, conn):
'''
--- /dev/null
+The :mod:`multiprocessing` ``Server`` class now explicitly catchs
+:exc:`SystemExit` and closes the client connection in this case. It happens
+when the ``Server.serve_client()`` method reachs the end of file (EOF).