Add disconnect callback - #263
Open
LukaszMoskala wants to merge 2 commits into
Open
Conversation
Author
|
Interesting, tests pass on my local machine ( Can this test be re-run? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
DisconnectCallback, invoked when a connection dies after the SSH session was successfully established. This complements the existingConnectionFailedCallback, which only covers connection failures.Motivation
With SSH
ControlMaster, multiple interactive sessions can share a single underlying SSH connection. When those sessions share resources tied to the connection, there needs to be a reliable hook to release them once the connection actually closes.Releasing resources after the last interactive session closes isn't sufficient: with
ControlMaster, the underlying SSH connection may still be alive and can still open new interactive sessions.DisconnectCallbackfires specifically when the SSH connection itself ends, so cleanup only happens when no further sessions can be opened.I have tested this and it works as expected.
Thank you for maintaining this library and have a nice day!