diff options
Diffstat (limited to 'src/server/protocol.rs')
| -rw-r--r-- | src/server/protocol.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/server/protocol.rs b/src/server/protocol.rs index 7d0d3e2d..6745b0db 100644 --- a/src/server/protocol.rs +++ b/src/server/protocol.rs @@ -79,6 +79,14 @@ pub enum ClientMessage { /// Graceful disconnect request. Detach, + + /// Switch this connection into direct terminal attach mode. + AttachTerminal { + /// Terminal id to attach to. + terminal_id: String, + /// Replace an existing writable attach owner for this terminal. + takeover: bool, + }, } // --------------------------------------------------------------------------- @@ -647,6 +655,18 @@ mod tests { assert_eq!(msg, decoded); } + #[test] + fn client_attach_terminal_roundtrip() { + let msg = ClientMessage::AttachTerminal { + terminal_id: "term_123".to_owned(), + takeover: true, + }; + let encoded = bincode::serde::encode_to_vec(&msg, bincode::config::standard()).unwrap(); + let (decoded, _): (ClientMessage, _) = + bincode::serde::decode_from_slice(&encoded, bincode::config::standard()).unwrap(); + assert_eq!(msg, decoded); + } + // ---- Round-trip: ServerMessage ---- #[test] |
