diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-17 01:41:17 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-17 01:41:17 +0300 |
| commit | 3ecacfddae86d603bfd0d1a0c01602b1d34b1df3 (patch) | |
| tree | 277941c065295af2bd161c6be6fd7a2555c1f060 /src/server/protocol.rs | |
| parent | a36da363f14639085bec91d7a378d6c2eeaa6c58 (diff) | |
feat: add direct terminal attach stream
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] |
