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),
|
||||
),
|
||||
);
|
||||
} else if self.config.identifier != identifier {
|
||||
self.connections.insert(
|
||||
*addr,
|
||||
Connection::from(
|
||||
*addr,
|
||||
ConnectionState::Closing(CloseReason::InvalidIdentifier),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
self.connections.insert(
|
||||
*addr,
|
||||
|
||||
@ -17,6 +17,7 @@ pub enum CloseReason {
|
||||
ShuttingDown,
|
||||
/// Closed because local peer initiated close
|
||||
SelfClosed,
|
||||
InvalidIdentifier,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CloseReason {
|
||||
@ -27,6 +28,7 @@ impl std::fmt::Display for CloseReason {
|
||||
CloseReason::Error => write!(f, "Error"),
|
||||
CloseReason::ShuttingDown => write!(f, "Shutting down"),
|
||||
CloseReason::SelfClosed => write!(f, "Closed"),
|
||||
CloseReason::InvalidIdentifier => write!(f, "Invalid Identifier"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user