feat: run session hooks on client connect and disconnect - #27
Open
maryny4 wants to merge 1 commit into
Open
Conversation
Add on_client_connect / on_client_disconnect options (config and CLI) that run a shell command when the first client connects and the last one disconnects. Connections are counted so parallel sessions or port probes during an active session do not retrigger the hooks. Useful for adjusting monitor scale for the remote session, waking DPMS, or sending notifications. (cherry picked from commit 5a451b2)
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.
Add
on_client_connect/on_client_disconnectoptions (config file and CLI) that run a shell command when the first client connects and the last one disconnects, wired through ironrdp's existingConnectionHandler.Connections are counted so parallel sessions or port probes during an active session do not retrigger the hooks; spawned commands are reaped in the background and a non-zero exit lands in the log as a warning. With no hooks configured nothing changes — the connection handler is not installed at all.
The model follows Sunshine's
prep-cmddo/undo pattern. Typical uses: switch the captured output's scale to match the remote client's DPI for the session and restore it on disconnect, wake DPMS, send a notification.Known limitation: ironrdp's
on_acceptfires on TCP accept, before authentication, so a lone port probe while idle runs the hooks once. Probes during an active session are filtered by the connection counter.cargo fmt --check,clippy -- -D warnings,cargo test(both feature sets) pass; unit tests cover the edge-transition counting including the parallel-probe sequence.