# HG changeset patch # User greg # Date 1224851812 -7200 # Node ID 0bc32427a459565ca6fc889b4f3bab6e4f354b9d # Parent 141a7145c099c46607eac348f3fd37dcb949380c fix bug in beremiz_service with the MainLoop diff -r 141a7145c099 -r 0bc32427a459 Beremiz_service.py --- a/Beremiz_service.py Fri Oct 24 14:01:36 2008 +0200 +++ b/Beremiz_service.py Fri Oct 24 14:36:52 2008 +0200 @@ -177,7 +177,7 @@ self.workdir = workdir self.args = args self.plcobj = None - self.servicepublisher = ServicePublisher.ServicePublisher() + self.servicepublisher = None def Loop(self): while self.continueloop: @@ -203,7 +203,8 @@ # Configure and publish service # Not publish service if localhost in address params if self.ip != "localhost" and self.ip != "127.0.0.1": - print "Publish service on local network" + print "Publish service on local network" + self.servicepublisher = ServicePublisher.ServicePublisher() self.servicepublisher.RegisterService(self.name, self.ip, self.port) sys.stdout.flush() @@ -211,7 +212,9 @@ self.daemon.requestLoop() def Stop(self): - self.servicepublisher.UnRegisterService() + if self.servicepublisher is not None: + self.servicepublisher.UnRegisterService() + del self.servicepublisher self.daemon.shutdown(True) class ParamsEntryDialog(wx.TextEntryDialog): @@ -335,6 +338,7 @@ def OnTaskBarQuit(self,evt): pyroserver.Quit() self.RemoveIcon() + wx.GetApp().ExitMainLoop() pyroserver = Server(name, ip, port, WorkingDir, args)