Skip to content

Commit

Permalink
Merge pull request pymodbus-dev#81 from estan/master
Browse files Browse the repository at this point in the history
Signal handlers to stop in shutdown().
  • Loading branch information
bashwork committed Sep 26, 2015
2 parents c60587d + 15a0286 commit d291ed5
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 d291ed5

Please sign in to comment.