Skip to content

Commit

Permalink
Make OneShotServer terminates after client connection ends
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamBruneau committed Jul 26, 2019
1 parent d403421 commit 3ac1cdc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rpyc/utils/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _authenticate_and_serve_client(self, sock):
sock.shutdown(socket.SHUT_RDWR)
except Exception:
pass
sock.close()
closing(sock)
self.clients.discard(sock)

def _serve_client(self, sock, credentials):
Expand Down Expand Up @@ -286,8 +286,10 @@ class OneShotServer(Server):
"""

def _accept_method(self, sock):
with closing(sock):
try:
self._authenticate_and_serve_client(sock)
finally:
self.close()


class ThreadedServer(Server):
Expand Down

0 comments on commit 3ac1cdc

Please # to comment.