@@ -24,7 +24,7 @@ use ceramic_core::{EventId, PeerKey};
2424use futures:: { future:: BoxFuture , FutureExt } ;
2525use libp2p:: {
2626 core:: ConnectedPoint ,
27- swarm:: { ConnectionId , NetworkBehaviour , NotifyHandler , ToSwarm } ,
27+ swarm:: { CloseConnection , ConnectionId , NetworkBehaviour , NotifyHandler , ToSwarm } ,
2828} ;
2929use libp2p_identity:: PeerId ;
3030use std:: {
@@ -215,7 +215,7 @@ where
215215 fn on_connection_handler_event (
216216 & mut self ,
217217 peer_id : libp2p_identity:: PeerId ,
218- _connection_id : libp2p:: swarm:: ConnectionId ,
218+ connection_id : libp2p:: swarm:: ConnectionId ,
219219 event : libp2p:: swarm:: THandlerOutEvent < Self > ,
220220 ) {
221221 let ev = match event {
@@ -229,8 +229,11 @@ where
229229 status : info. status ,
230230 } ) ) )
231231 } else {
232- tracing:: warn!( %peer_id, "peer not found in peers map when started synchronizing?" ) ;
233- None
232+ tracing:: warn!( %peer_id, ?connection_id, "peer not found in peers map when started synchronizing? closing connection" ) ;
233+ Some ( ToSwarm :: CloseConnection {
234+ peer_id,
235+ connection : CloseConnection :: One ( connection_id) ,
236+ } )
234237 }
235238 }
236239
@@ -244,8 +247,11 @@ where
244247 status : info. status ,
245248 } ) ) )
246249 } else {
247- tracing:: warn!( %peer_id, "peer not found in peers map when stopped synchronizing?" ) ;
248- None
250+ tracing:: warn!( %peer_id, ?connection_id, "peer not found in peers map when stopped synchronizing? closing connection" ) ;
251+ Some ( ToSwarm :: CloseConnection {
252+ peer_id,
253+ connection : CloseConnection :: One ( connection_id) ,
254+ } )
249255 }
250256 }
251257
@@ -276,8 +282,11 @@ where
276282 status : info. status ,
277283 } ) ) )
278284 } else {
279- tracing:: warn!( %peer_id, "peer not found in peers map when succeeded synchronizing?" ) ;
280- None
285+ tracing:: warn!( %peer_id, ?connection_id, "peer not found in peers map when succeeded synchronizing? closing connection" ) ;
286+ Some ( ToSwarm :: CloseConnection {
287+ peer_id,
288+ connection : CloseConnection :: One ( connection_id) ,
289+ } )
281290 }
282291 }
283292
@@ -307,8 +316,11 @@ where
307316 status : info. status ,
308317 } ) ) )
309318 } else {
310- tracing:: warn!( %peer_id, "peer not found in peers map when failed synchronizing?" ) ;
311- None
319+ tracing:: warn!( %peer_id, ?connection_id, "peer not found in peers map when failed synchronizing? closing connectoin" ) ;
320+ Some ( ToSwarm :: CloseConnection {
321+ peer_id,
322+ connection : CloseConnection :: One ( connection_id) ,
323+ } )
312324 }
313325 }
314326 } ;
0 commit comments