Skip to content

Commit

Permalink
Signal handlers to stop in shutdown().
Browse files Browse the repository at this point in the history
  • Loading branch information
estan committed May 3, 2015
1 parent fec7ac3 commit 15a0286
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pymodbus/server/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ def process_request(self, request, client):
_logger.debug("Started thread to serve client at " + str(client))
SocketServer.ThreadingTCPServer.process_request(self, request, client)

def shutdown(self):
''' Stops the serve_forever loop.
Overridden to signal handlers to stop.
'''
for thread in self.threads:
thread.running = False
SocketServer.ThreadingTCPServer.shutdown(self)

def server_close(self):
''' Callback for stopping the running server
'''
Expand Down

0 comments on commit 15a0286

Please sign in to comment.