MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / run

Method run

opcua/client/client.py:56–72  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

54 self.timeout = 3600000 # 1 hour
55
56 def run(self):
57 _logger.debug("starting keepalive thread with period of %s milliseconds", self.timeout)
58 server_state = self.client.get_node(ua.FourByteNodeId(ua.ObjectIds.Server_ServerStatus_State))
59 while not self._dostop:
60 with self._cond:
61 self._cond.wait(self.timeout / 1000)
62 if self._dostop:
63 break
64 _logger.debug("renewing channel")
65 try:
66 self.client.open_secure_channel(renew=True)
67 except concurrent.futures.TimeoutError:
68 _logger.debug("keepalive failed: timeout on open_secure_channel()")
69 break
70 val = server_state.get_value()
71 _logger.debug("server state is: %s ", val)
72 _logger.debug("keepalive thread has stopped")
73
74 def stop(self):
75 _logger.debug("stoping keepalive thread")

Callers

nothing calls this directly

Calls 3

get_valueMethod · 0.80
get_nodeMethod · 0.45
open_secure_channelMethod · 0.45

Tested by

no test coverage detected