Skip to content

Commit

Permalink
bridge: Exit beiboot when ssh exits
Browse files Browse the repository at this point in the history
The cockpit.beiboot process shouldn't live on when its `ssh` process
exits during the session. Note that we must only do this after the ferny
negotiation, as that sends its own (specific) problem codes.

Covered by `TestSession.testBasic`.
  • Loading branch information
martinpitt committed Sep 27, 2024
1 parent 9bdbf4b commit a3ba462
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cockpit/beiboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ def do_init(self, message):
logger.debug("SshBridge.do_init: %r", message)
self.ssh_peer.write_control(message)

def setup_session(self) -> None:
# if ssh dies during the session, go down with it
self.ssh_peer.add_done_callback(self.close)


async def run(args) -> None:
logger.debug("Hi. How are you today?")
Expand Down Expand Up @@ -464,6 +468,7 @@ async def run(args) -> None:
return

logger.debug('Startup done. Looping until connection closes.')
bridge.setup_session()
try:
await bridge.communicate()
except BrokenPipeError:
Expand Down

0 comments on commit a3ba462

Please sign in to comment.