summaryrefslogtreecommitdiff
path: root/src/event/disconnect.rs
blob: 6511027a51e67e76cad44d63c9d9fa6a13e22009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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,
}