File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,22 @@ impl ConnectionManager {
140140 }
141141 links. retain ( |entry| entry. peer != * peer) ;
142142 links. push_back ( CourtesyLink { peer : peer. clone ( ) } ) ;
143+ tracing:: info!(
144+ %peer,
145+ len = links. len( ) ,
146+ max = self . max_courtesy_links,
147+ "register_courtesy_connection: tracked courtesy link"
148+ ) ;
143149 if links. len ( ) > self . max_courtesy_links {
144- links. pop_front ( ) . map ( |entry| entry. peer )
150+ let evicted = links. pop_front ( ) . map ( |entry| entry. peer ) ;
151+ if let Some ( ref victim) = evicted {
152+ tracing:: info!(
153+ %victim,
154+ %peer,
155+ "register_courtesy_connection: evicting oldest courtesy link to stay under budget"
156+ ) ;
157+ }
158+ evicted
145159 } else {
146160 None
147161 }
@@ -155,7 +169,15 @@ impl ConnectionManager {
155169 if links. is_empty ( ) {
156170 return ;
157171 }
172+ let before = links. len ( ) ;
158173 links. retain ( |entry| entry. peer != * peer) ;
174+ if links. len ( ) != before {
175+ tracing:: debug!(
176+ %peer,
177+ remaining = links. len( ) ,
178+ "unregister_courtesy_connection: removed courtesy tracking entry"
179+ ) ;
180+ }
159181 }
160182
161183 /// Whether a node should accept a new node connection or not based
You can’t perform that action at this time.
0 commit comments