Skip to content

Commit 080d837

Browse files
committed
fix: guard transient map lockless and prevent reserved overflow
- Switch transient_connections to DashMap and use direct DashMap APIs - Saturate reserved_connections increment to avoid overflow/underflow and log a warn instead of looping at usize::MAX
1 parent d3aa38e commit 080d837

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/core/src/ring/connection_manager.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,13 @@ impl ConnectionManager {
410410
self.transient_connections.contains_key(peer)
411411
}
412412

413+
#[allow(dead_code)]
414+
pub fn is_transient_addr(&self, addr: &SocketAddr) -> bool {
415+
self.transient_connections
416+
.iter()
417+
.any(|entry| entry.key().addr == *addr)
418+
}
419+
413420
pub fn transient_count(&self) -> usize {
414421
self.transient_in_use.load(Ordering::Acquire)
415422
}

0 commit comments

Comments
 (0)