Skip to content

Add disconnect callback - #263

Open
LukaszMoskala wants to merge 2 commits into
gliderlabs:masterfrom
LukaszMoskala:master
Open

Add disconnect callback#263
LukaszMoskala wants to merge 2 commits into
gliderlabs:masterfrom
LukaszMoskala:master

Conversation

@LukaszMoskala

Copy link
Copy Markdown

Summary

Adds a DisconnectCallback, invoked when a connection dies after the SSH session was successfully established. This complements the existing ConnectionFailedCallback, 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. DisconnectCallback fires 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!

@LukaszMoskala

Copy link
Copy Markdown
Author

Interesting, tests pass on my local machine (go version go1.27.0-X:nodwarf5 linux/amd64) every time.

Can this test be re-run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant