summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/errors.rs
diff options
context:
space:
mode:
authorhar7an <99636919+har7an@users.noreply.github.com>2023-01-22 18:04:40 +0000
committerGitHub <noreply@github.com>2023-01-22 18:04:40 +0000
commitbeddfb77a8ef8a5b90db084ad8030d1168f77352 (patch)
tree1617d19a1b9cbd0be487be1ef06c53ee376f189b /zellij-utils/src/errors.rs
parentb274fc5ab19abe8b3ef7f7afe38897f526263414 (diff)
Improve client disconnect handling (#2068)
* xtask/run: Use varargs when run with `-data-dir` Previously any additional arguments passed on the command line were ignored. Now they are appended to `cargo run ...` as documented. * server/os_i_o: Improve error message when IPC dies and display the last send/recv error to the user instead of a generic "Buffer full" message. * server/lib: Log error in `send_to_client!` so we will know when an error occured while trying to send a message to the client. The most likely cause for this is that the client buffer filled up and hence we cannot send any new messages. While we still disconnect the client as before, now we also write a log message that explains the situation. * utils/channel: Apply rustfmt * server/lib: Detect when client responds too slow and log a message before disconnecting it. * server/os_i_o: Add retry queue to client senders that is dynamically allocated on-demand and stores `ServerToClientMsg` in case the regular IPC channel is currently full. This acts as a dynamic buffer to hold and buffer messages for a while until the client hopefully catches up. Also write a message to the log to indicate when the client is recognized to be too slow in handling server messages. * server: apply rustfmt * utils/ipc: Add session name to "Disconnect" error * utils/ipc: Fix error message indent * server/os_i_o: Undo IPC channel extension via `Vec` and drastically increase the IPC message queue size instead. Measurements didn't discover a drastic increase in RAM caused by this, and it is a much easier fix for the problem at hand. * CHANGELOG: Add PR #2068
Diffstat (limited to 'zellij-utils/src/errors.rs')
-rw-r--r--zellij-utils/src/errors.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 7fbed99ed..b56bd79a1 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -469,6 +469,9 @@ open an issue on GitHub:
#[error("an error occured")]
GenericError { source: anyhow::Error },
+
+ #[error("Client {client_id} is too slow to handle incoming messages")]
+ ClientTooSlow { client_id: u16 },
}
#[cfg(not(target_family = "wasm"))]