diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-02-19 17:25:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-19 17:25:46 +0100 |
| commit | 007aa2930b5593b75ef503b97c1f83f17a3c21b2 (patch) | |
| tree | d4c9a110b28e13c843336221824f0d582d3edbcb /zellij-utils | |
| parent | Purge `async_std` from the codebase (#4672) (diff) | |
| download | sl0ppij-007aa2930b5593b75ef503b97c1f83f17a3c21b2.tar.gz sl0ppij-007aa2930b5593b75ef503b97c1f83f17a3c21b2.tar.xz sl0ppij-007aa2930b5593b75ef503b97c1f83f17a3c21b2.zip | |
fix: do not attempt to reconnect from the web if kicked from the session (#4730)
* fix: do not attempt to reconnect from the web if kicked from the session
* fix: add missing protobuf definition
* add pr
Diffstat (limited to 'zellij-utils')
| -rw-r--r-- | zellij-utils/assets/prost_ipc/client_server_contract.rs | 235 | ||||
| -rw-r--r-- | zellij-utils/src/client_server_contract/common_types.proto | 1 | ||||
| -rw-r--r-- | zellij-utils/src/ipc.rs | 2 | ||||
| -rw-r--r-- | zellij-utils/src/ipc/protobuf_conversion.rs | 2 |
4 files changed, 124 insertions, 116 deletions
diff --git a/zellij-utils/assets/prost_ipc/client_server_contract.rs b/zellij-utils/assets/prost_ipc/client_server_contract.rs index 8a9e8bd2..a6ed7a1d 100644 --- a/zellij-utils/assets/prost_ipc/client_server_contract.rs +++ b/zellij-utils/assets/prost_ipc/client_server_contract.rs @@ -2178,6 +2178,7 @@ pub enum ExitReason { WebClientsForbidden = 6, Error = 7, CustomExitStatus = 8, + KickedByHost = 9, } impl ExitReason { /// String value of the enum field names used in the ProtoBuf definition. @@ -2195,6 +2196,7 @@ impl ExitReason { ExitReason::WebClientsForbidden => "EXIT_REASON_WEB_CLIENTS_FORBIDDEN", ExitReason::Error => "EXIT_REASON_ERROR", ExitReason::CustomExitStatus => "EXIT_REASON_CUSTOM_EXIT_STATUS", + ExitReason::KickedByHost => "EXIT_REASON_KICKED_BY_HOST", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -2209,6 +2211,7 @@ impl ExitReason { "EXIT_REASON_WEB_CLIENTS_FORBIDDEN" => Some(Self::WebClientsForbidden), "EXIT_REASON_ERROR" => Some(Self::Error), "EXIT_REASON_CUSTOM_EXIT_STATUS" => Some(Self::CustomExitStatus), + "EXIT_REASON_KICKED_BY_HOST" => Some(Self::KickedByHost), _ => None, } } @@ -2533,6 +2536,122 @@ impl WebSharing { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerToClientMsg { + #[prost(oneof="server_to_client_msg::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13")] + pub message: ::core::option::Option<server_to_client_msg::Message>, +} +/// Nested message and enum types in `ServerToClientMsg`. +pub mod server_to_client_msg { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Message { + #[prost(message, tag="1")] + Render(super::RenderMsg), + #[prost(message, tag="2")] + UnblockInputThread(super::UnblockInputThreadMsg), + #[prost(message, tag="3")] + Exit(super::ExitMsg), + #[prost(message, tag="4")] + Connected(super::ConnectedMsg), + #[prost(message, tag="5")] + Log(super::LogMsg), + #[prost(message, tag="6")] + LogError(super::LogErrorMsg), + #[prost(message, tag="7")] + SwitchSession(super::SwitchSessionMsg), + #[prost(message, tag="8")] + UnblockCliPipeInput(super::UnblockCliPipeInputMsg), + #[prost(message, tag="9")] + CliPipeOutput(super::CliPipeOutputMsg), + #[prost(message, tag="10")] + QueryTerminalSize(super::QueryTerminalSizeMsg), + #[prost(message, tag="11")] + StartWebServer(super::StartWebServerMsg), + #[prost(message, tag="12")] + RenamedSession(super::RenamedSessionMsg), + #[prost(message, tag="13")] + ConfigFileUpdated(super::ConfigFileUpdatedMsg), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenderMsg { + #[prost(string, tag="1")] + pub content: ::prost::alloc::string::String, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnblockInputThreadMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExitMsg { + #[prost(enumeration="ExitReason", tag="1")] + pub exit_reason: i32, + #[prost(string, optional, tag="2")] + pub payload: ::core::option::Option<::prost::alloc::string::String>, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConnectedMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogMsg { + #[prost(string, repeated, tag="1")] + pub lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogErrorMsg { + #[prost(string, repeated, tag="1")] + pub lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchSessionMsg { + #[prost(message, optional, tag="1")] + pub connect_to_session: ::core::option::Option<ConnectToSession>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnblockCliPipeInputMsg { + #[prost(string, tag="1")] + pub pipe_name: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CliPipeOutputMsg { + #[prost(string, tag="1")] + pub pipe_name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub output: ::prost::alloc::string::String, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTerminalSizeMsg { +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StartWebServerMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RenamedSessionMsg { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, +} +/// Empty message +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigFileUpdatedMsg { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientToServerMsg { #[prost(oneof="client_to_server_msg::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16")] pub message: ::core::option::Option<client_to_server_msg::Message>, @@ -2689,119 +2808,3 @@ pub struct FailedToStartWebServerMsg { #[prost(string, tag="1")] pub error: ::prost::alloc::string::String, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ServerToClientMsg { - #[prost(oneof="server_to_client_msg::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13")] - pub message: ::core::option::Option<server_to_client_msg::Message>, -} -/// Nested message and enum types in `ServerToClientMsg`. -pub mod server_to_client_msg { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Message { - #[prost(message, tag="1")] - Render(super::RenderMsg), - #[prost(message, tag="2")] - UnblockInputThread(super::UnblockInputThreadMsg), - #[prost(message, tag="3")] - Exit(super::ExitMsg), - #[prost(message, tag="4")] - Connected(super::ConnectedMsg), - #[prost(message, tag="5")] - Log(super::LogMsg), - #[prost(message, tag="6")] - LogError(super::LogErrorMsg), - #[prost(message, tag="7")] - SwitchSession(super::SwitchSessionMsg), - #[prost(message, tag="8")] - UnblockCliPipeInput(super::UnblockCliPipeInputMsg), - #[prost(message, tag="9")] - CliPipeOutput(super::CliPipeOutputMsg), - #[prost(message, tag="10")] - QueryTerminalSize(super::QueryTerminalSizeMsg), - #[prost(message, tag="11")] - StartWebServer(super::StartWebServerMsg), - #[prost(message, tag="12")] - RenamedSession(super::RenamedSessionMsg), - #[prost(message, tag="13")] - ConfigFileUpdated(super::ConfigFileUpdatedMsg), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RenderMsg { - #[prost(string, tag="1")] - pub content: ::prost::alloc::string::String, -} -/// Empty message -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UnblockInputThreadMsg { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ExitMsg { - #[prost(enumeration="ExitReason", tag="1")] - pub exit_reason: i32, - #[prost(string, optional, tag="2")] - pub payload: ::core::option::Option<::prost::alloc::string::String>, -} -/// Empty message -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ConnectedMsg { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct LogMsg { - #[prost(string, repeated, tag="1")] - pub lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct LogErrorMsg { - #[prost(string, repeated, tag="1")] - pub lines: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SwitchSessionMsg { - #[prost(message, optional, tag="1")] - pub connect_to_session: ::core::option::Option<ConnectToSession>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UnblockCliPipeInputMsg { - #[prost(string, tag="1")] - pub pipe_name: ::prost::alloc::string::String, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CliPipeOutputMsg { - #[prost(string, tag="1")] - pub pipe_name: ::prost::alloc::string::String, - #[prost(string, tag="2")] - pub output: ::prost::alloc::string::String, -} -/// Empty message -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryTerminalSizeMsg { -} -/// Empty message -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct StartWebServerMsg { -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RenamedSessionMsg { - #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, -} -/// Empty message -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ConfigFileUpdatedMsg { -} diff --git a/zellij-utils/src/client_server_contract/common_types.proto b/zellij-utils/src/client_server_contract/common_types.proto index a2f74f08..59305d7a 100644 --- a/zellij-utils/src/client_server_contract/common_types.proto +++ b/zellij-utils/src/client_server_contract/common_types.proto @@ -791,6 +791,7 @@ enum ExitReason { EXIT_REASON_WEB_CLIENTS_FORBIDDEN = 6; EXIT_REASON_ERROR = 7; EXIT_REASON_CUSTOM_EXIT_STATUS = 8; + EXIT_REASON_KICKED_BY_HOST = 9; } // Additional supporting types for Action messages diff --git a/zellij-utils/src/ipc.rs b/zellij-utils/src/ipc.rs index 455fd4b3..d1a6c99e 100644 --- a/zellij-utils/src/ipc.rs +++ b/zellij-utils/src/ipc.rs @@ -183,6 +183,7 @@ pub enum ExitReason { CannotAttach, Disconnect, WebClientsForbidden, + KickedByHost, CustomExitStatus(i32), Error(String), } @@ -228,6 +229,7 @@ There are a few things you can try now: " ) }, + Self::KickedByHost => write!(f, "Disconnected by host"), Self::CustomExitStatus(exit_status) => write!(f, "Exit {}", exit_status), Self::Error(e) => write!(f, "Error occurred in server:\n{}", e), } diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs index 7538b225..894bdac8 100644 --- a/zellij-utils/src/ipc/protobuf_conversion.rs +++ b/zellij-utils/src/ipc/protobuf_conversion.rs @@ -2279,6 +2279,7 @@ impl From<ExitReason> for ProtoExitReason { ExitReason::CannotAttach => ProtoExitReason::CannotAttach, ExitReason::Disconnect => ProtoExitReason::Disconnect, ExitReason::WebClientsForbidden => ProtoExitReason::WebClientsForbidden, + ExitReason::KickedByHost => ProtoExitReason::KickedByHost, ExitReason::Error(_msg) => ProtoExitReason::Error, ExitReason::CustomExitStatus(_status) => ProtoExitReason::CustomExitStatus, } @@ -2295,6 +2296,7 @@ impl TryFrom<ProtoExitReason> for ExitReason { ProtoExitReason::CannotAttach => Ok(ExitReason::CannotAttach), ProtoExitReason::Disconnect => Ok(ExitReason::Disconnect), ProtoExitReason::WebClientsForbidden => Ok(ExitReason::WebClientsForbidden), + ProtoExitReason::KickedByHost => Ok(ExitReason::KickedByHost), ProtoExitReason::Error => Ok(ExitReason::Error("Protobuf error".to_string())), ProtoExitReason::CustomExitStatus => Ok(ExitReason::CustomExitStatus(0)), ProtoExitReason::Unspecified => Err(anyhow!("Unspecified exit reason")), |
