mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 18:59:51 +00:00
[thci] add SSH keepalive (#7999)
Add SSH keepalive to avoid disconnection after idle for a long time.
This commit is contained in:
@@ -60,6 +60,8 @@ logging.getLogger('paramiko').setLevel(logging.WARNING)
|
||||
|
||||
|
||||
class SSHHandle(object):
|
||||
# Unit: second
|
||||
KEEPALIVE_INTERVAL = 30
|
||||
|
||||
def __init__(self, ip, port, username, password):
|
||||
self.ip = ip
|
||||
@@ -85,6 +87,9 @@ class SSHHandle(object):
|
||||
else:
|
||||
raise
|
||||
|
||||
# Avoid SSH disconnection after idle for a long time
|
||||
self.__handle.get_transport().set_keepalive(self.KEEPALIVE_INTERVAL)
|
||||
|
||||
def close(self):
|
||||
if self.__handle is not None:
|
||||
self.__handle.close()
|
||||
|
||||
Reference in New Issue
Block a user