From bb41e396aca01fee9f81785681fac0a79d0fd9d8 Mon Sep 17 00:00:00 2001 From: zirkonya Date: Thu, 27 Aug 2026 09:45:12 +0200 Subject: split event and enhance context --- src/event/disconnect.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/event/disconnect.rs (limited to 'src/event/disconnect.rs') 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 +where + Uid: PartialEq, +{ + #[getset(get = "pub")] + connection_id: Uid, + #[getset(get = "pub")] + reason: DisconnectReason, +} -- cgit v1.2.3