Skip to content

Commit

Permalink
Merge pull request #344 from WilliamBruneau/fix_oneshotserver
Browse files Browse the repository at this point in the history
Make OneShotServer terminates after client connection ends
  • Loading branch information
comrumino committed Jul 27, 2019
2 parents d403421 + 3ac1cdc commit 6027430
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 6027430

Please # to comment.