Tear down client's connection states when dropping test clients

This commit is contained in:
Max Brunsfeld 2022-03-01 18:17:41 -08:00
parent 3cf5329450
commit ae93cfed50

View file

@ -230,10 +230,12 @@ impl Client {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
pub fn tear_down(&self) { pub fn tear_down(&self) {
let mut state = self.state.write(); let mut state = self.state.write();
state._maintain_connection.take();
state.message_handlers.clear(); state.message_handlers.clear();
state.models_by_message_type.clear(); state.models_by_message_type.clear();
state.models_by_entity_type_and_remote_id.clear(); state.models_by_entity_type_and_remote_id.clear();
state.entity_id_extractors.clear(); state.entity_id_extractors.clear();
self.peer.reset();
} }
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]