Add proper error for InvalidIdentifier
This commit is contained in:
parent
8abcf7f0b7
commit
37dbaabf88
@ -273,6 +273,14 @@ impl<T: std::fmt::Debug + Clone + Serialize + DeserializeOwned + Send + Sync + '
|
|||||||
ConnectionState::Closing(CloseReason::NotAcceptingConnections),
|
ConnectionState::Closing(CloseReason::NotAcceptingConnections),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if self.config.identifier != identifier {
|
||||||
|
self.connections.insert(
|
||||||
|
*addr,
|
||||||
|
Connection::from(
|
||||||
|
*addr,
|
||||||
|
ConnectionState::Closing(CloseReason::InvalidIdentifier),
|
||||||
|
),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
self.connections.insert(
|
self.connections.insert(
|
||||||
*addr,
|
*addr,
|
||||||
|
|||||||
@ -17,6 +17,7 @@ pub enum CloseReason {
|
|||||||
ShuttingDown,
|
ShuttingDown,
|
||||||
/// Closed because local peer initiated close
|
/// Closed because local peer initiated close
|
||||||
SelfClosed,
|
SelfClosed,
|
||||||
|
InvalidIdentifier,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for CloseReason {
|
impl std::fmt::Display for CloseReason {
|
||||||
@ -27,6 +28,7 @@ impl std::fmt::Display for CloseReason {
|
|||||||
CloseReason::Error => write!(f, "Error"),
|
CloseReason::Error => write!(f, "Error"),
|
||||||
CloseReason::ShuttingDown => write!(f, "Shutting down"),
|
CloseReason::ShuttingDown => write!(f, "Shutting down"),
|
||||||
CloseReason::SelfClosed => write!(f, "Closed"),
|
CloseReason::SelfClosed => write!(f, "Closed"),
|
||||||
|
CloseReason::InvalidIdentifier => write!(f, "Invalid Identifier"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user