tari-project / tari

The Tari protocol
https://tari.com
BSD 3-Clause "New" or "Revised" License
345 stars 212 forks source link

Replace Minimized with DisconnectReason in comms #6331

Open hansieodendaal opened 4 months ago

hansieodendaal commented 4 months ago

It appears that this is only used to improve logs.

Not necessary for now but I'd suggest making this a general reason enum (you can use thiserror for the human readable text or impl Display)

#[derive(Debug, Clone, Copy, thiserror::Error)]
pub enum DisconnectReason {
    #[error("Remote disconnected")]
    RemoteDisconnected,
    #[error("Connection was culled because it was inactive")]
    ConnectionCulledInactive, 
     #[error("Connection was culled to reduce number of connections")]
    ConnectionCulledMinimise
    #[error("Local node explicit disconnect")]
    LocalDisconnected
}

_Originally posted by @sdbondi in https://github.com/tari-project/tari/pull/6307#discussion_r1596245589_