diff --git a/pymodbus/server/sync.py b/pymodbus/server/sync.py index d2d2ca8be..0b915bef0 100644 --- a/pymodbus/server/sync.py +++ b/pymodbus/server/sync.py @@ -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 '''