make sure event is triggered when peer conn remove (#1507)

This commit is contained in:
Sijie.Sun
2025-10-22 23:37:19 +08:00
committed by GitHub
parent bbe8f9f810
commit 7485f5f64e

View File

@@ -226,6 +226,11 @@ impl Peer {
// pritn on drop
impl Drop for Peer {
fn drop(&mut self) {
self.conns.retain(|_, conn| {
self.global_ctx
.issue_event(GlobalCtxEvent::PeerConnRemoved(conn.get_conn_info()));
false
});
self.shutdown_notifier.notify_one();
tracing::info!("peer {} drop", self.peer_node_id);
}