(self)
| 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") |
nothing calls this directly
no test coverage detected