Skip to content

Commit

Permalink
util/ssh: stop keepalive in disconnect() when existing connection is …
Browse files Browse the repository at this point in the history
…used

SSHConnection does not open a new connection if an existing connection
is open. It reuses the connection and starts a keepalive command (cat).

On disconnect(), the keepalive command is only stopped for newly
initiated connections, not for existing ones. Fix that.

Signed-off-by: Bastian Krause <[email protected]>
  • Loading branch information
Bastian-Krause committed Jun 27, 2024
1 parent 4fd7caf commit 1eb7785
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions labgrid/util/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ def disconnect(self):
self._logger.info("Closing SSH connection to %s", self.host)
self._stop_keepalive()
self._stop_own_master()

# stop keepalive when existing connection is used
if self._keepalive:
self._stop_keepalive()
finally:
self._connected = False

Expand Down

0 comments on commit 1eb7785

Please sign in to comment.