Skip to content

Commit 175abc9

Browse files
committed
Merge pull request #81 from estan/master
Signal handlers to stop in shutdown().
2 parents cd9da27 + 15a0286 commit 175abc9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pymodbus/server/sync.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ def process_request(self, request, client):
258258
_logger.debug("Started thread to serve client at " + str(client))
259259
SocketServer.ThreadingTCPServer.process_request(self, request, client)
260260

261+
def shutdown(self):
262+
''' Stops the serve_forever loop.
263+
264+
Overridden to signal handlers to stop.
265+
'''
266+
for thread in self.threads:
267+
thread.running = False
268+
SocketServer.ThreadingTCPServer.shutdown(self)
269+
261270
def server_close(self):
262271
''' Callback for stopping the running server
263272
'''

0 commit comments

Comments
 (0)