Cleanup of some dead code in PYRO connector.
authorEdouard Tisserant
Thu, 12 Apr 2018 16:33:44 +0200
changeset 1982 092d98d56995
parent 1981 d0718654d9b0
child 1983 edd7a3a06d86
Cleanup of some dead code in PYRO connector.
connectors/PYRO/__init__.py
--- a/connectors/PYRO/__init__.py	Thu Apr 12 16:31:30 2018 +0200
+++ b/connectors/PYRO/__init__.py	Thu Apr 12 16:33:44 2018 +0200
@@ -148,41 +148,17 @@
             # for safe use in from debug thread, must create a copy
             self.RemotePLCObjectProxyCopy = None
 
-        def GetPyroProxy(self):
-            """
-            This func returns the real Pyro Proxy.
-            Use this if you musn't keep reference to it.
-            """
-            return RemotePLCObjectProxy
-
         def _PyroStartPLC(self, *args, **kwargs):
-            """
-            confnodesroot._connector.GetPyroProxy() is used
-            rather than RemotePLCObjectProxy because
-            object is recreated meanwhile,
-            so we must not keep ref to it here
-            """
-            current_status, _log_count = confnodesroot._connector.GetPyroProxy().GetPLCstatus()
-            if current_status == "Dirty":
-                # Some bad libs with static symbols may polute PLC
-                # ask runtime to suicide and come back again
-
-                confnodesroot.logger.write(_("Force runtime reload\n"))
-                confnodesroot._connector.GetPyroProxy().ForceReload()
-                confnodesroot._Disconnect()
-                # let remote PLC time to resurect.(freeze app)
-                sleep(0.5)
-                confnodesroot._Connect()
-            self.RemotePLCObjectProxyCopy = copy.copy(confnodesroot._connector.GetPyroProxy())
-            return confnodesroot._connector.GetPyroProxy().StartPLC(*args, **kwargs)
+            return RemotePLCObjectProxy.StartPLC(*args, **kwargs)
         StartPLC = PyroCatcher(_PyroStartPLC, False)
 
         def _PyroGetTraceVariables(self):
             """
-            for safe use in from debug thread, must use the copy
+            for use from debug thread, use a copy
+            pyro creates a new thread on server end proxy object is copied
             """
             if self.RemotePLCObjectProxyCopy is None:
-                self.RemotePLCObjectProxyCopy = copy.copy(confnodesroot._connector.GetPyroProxy())
+                self.RemotePLCObjectProxyCopy = copy.copy(RemotePLCObjectProxy)
             return self.RemotePLCObjectProxyCopy.GetTraceVariables()
         GetTraceVariables = PyroCatcher(_PyroGetTraceVariables, ("Broken", None))