diff options
| author | zirkonya <zirkonya@iridium.lan> | 2026-08-27 09:45:12 +0200 |
|---|---|---|
| committer | zirkonya <zirkonya@iridium.lan> | 2026-08-27 09:45:12 +0200 |
| commit | bb41e396aca01fee9f81785681fac0a79d0fd9d8 (patch) | |
| tree | 94ebe4800a50c14abc413cbcabe9ffaaab7496ef /src/event/disconnect.rs | |
| parent | 8bae725a803ee00bf5bc86b9fc0be6853b95115e (diff) | |
split event and enhance context
Diffstat (limited to 'src/event/disconnect.rs')
| -rw-r--r-- | src/event/disconnect.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/event/disconnect.rs b/src/event/disconnect.rs new file mode 100644 index 0000000..6511027 --- /dev/null +++ b/src/event/disconnect.rs @@ -0,0 +1,25 @@ +use std::io; + +use getset::Getters; + +// TODO : better error type for protocol violation +pub type ProtocolViolation = String; + +pub enum DisconnectReason { + Normal, + Error(io::Error), + ProtocolError(ProtocolViolation), + Timeout, + ServerShutdown, +} + +#[derive(Getters)] +pub struct DisconnectEvent<Uid> +where + Uid: PartialEq, +{ + #[getset(get = "pub")] + connection_id: Uid, + #[getset(get = "pub")] + reason: DisconnectReason, +} |
