diff --git a/samples/TCPClient.py b/samples/TCPClient.py index 83b5e5bf..b54c4c07 100644 --- a/samples/TCPClient.py +++ b/samples/TCPClient.py @@ -88,16 +88,16 @@ def indication(self, add_actor=None, del_actor=None, actor_error=None, error=Non if del_actor: if _debug: MiddleManASE._debug("indication del_actor=%r", del_actor) + # if there are no clients, quit + if not self.elementService.clients: + if _debug: MiddleManASE._debug(" - no clients, stopping") + stop() + if actor_error: if _debug: MiddleManASE._debug("indication actor_error=%r error=%r", actor_error, error) # tell the director to close self.elementService.disconnect(actor_error.peer) - # if there are no clients, quit - if not self.elementService.clients: - if _debug: MiddleManASE._debug(" - no clients, stopping") - stop() - bacpypes_debugging(MiddleManASE) #