equal
deleted
inserted
replaced
416 |
416 |
417 def Loop(self): |
417 def Loop(self): |
418 while self.continueloop: |
418 while self.continueloop: |
419 pyro.initServer() |
419 pyro.initServer() |
420 self.daemon = pyro.Daemon(host=self.ip_addr, port=self.port) |
420 self.daemon = pyro.Daemon(host=self.ip_addr, port=self.port) |
421 # pyro never frees memory after connection close if no timeout set |
421 # pyro never frees memory after connection close if no timeout set |
422 self.daemon.setTimeout(1); |
422 self.daemon.setTimeout(1) |
423 self.Start() |
423 self.Start() |
424 self.daemon.requestLoop() |
424 self.daemon.requestLoop() |
425 self.daemon.sock.close() |
425 self.daemon.sock.close() |
426 |
426 |
427 def Restart(self): |
427 def Restart(self): |
465 self.plcobj.StartPLC() |
465 self.plcobj.StartPLC() |
466 self.plcobj.StatusChange() |
466 self.plcobj.StatusChange() |
467 |
467 |
468 sys.stdout.flush() |
468 sys.stdout.flush() |
469 |
469 |
470 |
|
471 def _stop(self): |
470 def _stop(self): |
472 if self.plcobj is not None: |
471 if self.plcobj is not None: |
473 self.plcobj.StopPLC() |
472 self.plcobj.StopPLC() |
474 if self.servicepublisher is not None: |
473 if self.servicepublisher is not None: |
475 self.servicepublisher.UnRegisterService() |
474 self.servicepublisher.UnRegisterService() |
576 webport = None |
575 webport = None |
577 NS.WorkingDir = WorkingDir |
576 NS.WorkingDir = WorkingDir |
578 |
577 |
579 if wampconf is None: |
578 if wampconf is None: |
580 _wampconf = os.path.join(WorkingDir, "wampconf.json") |
579 _wampconf = os.path.join(WorkingDir, "wampconf.json") |
581 if os.path.exists(_wampconf) : |
580 if os.path.exists(_wampconf): |
582 wampconf = _wampconf |
581 wampconf = _wampconf |
583 |
582 |
584 if wampconf is not None: |
583 if wampconf is not None: |
585 try: |
584 try: |
586 import runtime.WampClient as WC # pylint: disable=ungrouped-imports |
585 import runtime.WampClient as WC # pylint: disable=ungrouped-imports |
603 except Exception, e: |
602 except Exception, e: |
604 print(_("Nevow Web service failed. "), e) |
603 print(_("Nevow Web service failed. "), e) |
605 |
604 |
606 if wampconf is not None: |
605 if wampconf is not None: |
607 try: |
606 try: |
608 _wampconf = WC.LoadWampClientConf(wampconf) # if project WAMP config is added |
607 _wampconf = WC.LoadWampClientConf(wampconf) |
609 if _wampconf : |
608 if _wampconf: |
610 if _wampconf["url"]: #TODO : test more ? |
609 if _wampconf["url"]: # TODO : test more ? |
611 WC.RegisterWampClient(wampconf, wampsecret) |
610 WC.RegisterWampClient(wampconf, wampsecret) |
612 pyruntimevars["wampsession"] = WC.GetSession |
611 pyruntimevars["wampsession"] = WC.GetSession |
613 WC.SetServer(pyroserver) |
612 WC.SetServer(pyroserver) |
614 else: |
613 else: |
615 print(_("WAMP config is incomplete.")) |
614 print(_("WAMP config is incomplete.")) |