@@ -325,7 +325,8 @@ impl ConnectionHandler for Handler {
325
325
326
326
// If there was a fatal error, close the connection.
327
327
if let Some ( error) = reported_error {
328
- return Poll :: Ready ( ConnectionHandlerEvent :: Close ( error) ) ;
328
+ self . keep_alive = KeepAlive :: No ;
329
+ log:: info!( "Gossipsub error: {error}" ) ;
329
330
}
330
331
}
331
332
@@ -340,9 +341,8 @@ impl ConnectionHandler for Handler {
340
341
341
342
if self . inbound_substreams_created > MAX_SUBSTREAM_CREATION {
342
343
// Too many inbound substreams have been created, end the connection.
343
- return Poll :: Ready ( ConnectionHandlerEvent :: Close (
344
- HandlerError :: MaxInboundSubstreams ,
345
- ) ) ;
344
+ self . keep_alive = KeepAlive :: No ;
345
+ log:: info!( "Gossipsub error: {}" , HandlerError :: MaxInboundSubstreams ) ;
346
346
}
347
347
348
348
// determine if we need to create the stream
@@ -351,9 +351,8 @@ impl ConnectionHandler for Handler {
351
351
&& !self . outbound_substream_establishing
352
352
{
353
353
if self . outbound_substreams_created >= MAX_SUBSTREAM_CREATION {
354
- return Poll :: Ready ( ConnectionHandlerEvent :: Close (
355
- HandlerError :: MaxOutboundSubstreams ,
356
- ) ) ;
354
+ self . keep_alive = KeepAlive :: No ;
355
+ log:: info!( "Gossipsub error: {}" , HandlerError :: MaxInboundSubstreams ) ;
357
356
}
358
357
let message = self . send_queue . remove ( 0 ) ;
359
358
self . send_queue . shrink_to_fit ( ) ;
@@ -475,14 +474,14 @@ impl ConnectionHandler for Handler {
475
474
Some ( OutboundSubstreamState :: WaitingOutput ( substream) ) ;
476
475
}
477
476
Err ( e) => {
478
- error ! ( "Error sending message: {}" , e ) ;
479
- return Poll :: Ready ( ConnectionHandlerEvent :: Close ( e ) ) ;
477
+ error ! ( "Error sending message: {e}" ) ;
478
+ break ;
480
479
}
481
480
}
482
481
}
483
482
Poll :: Ready ( Err ( e) ) => {
484
- error ! ( "Outbound substream error while sending output: {:?}" , e ) ;
485
- return Poll :: Ready ( ConnectionHandlerEvent :: Close ( e ) ) ;
483
+ error ! ( "Outbound substream error while sending output: {e :?}" ) ;
484
+ break ;
486
485
}
487
486
Poll :: Pending => {
488
487
self . keep_alive = KeepAlive :: Yes ;
@@ -504,7 +503,8 @@ impl ConnectionHandler for Handler {
504
503
Some ( OutboundSubstreamState :: WaitingOutput ( substream) )
505
504
}
506
505
Poll :: Ready ( Err ( e) ) => {
507
- return Poll :: Ready ( ConnectionHandlerEvent :: Close ( e) )
506
+ log:: info!( "NegotaitedSubstream error: {e}" ) ;
507
+ break ;
508
508
}
509
509
Poll :: Pending => {
510
510
self . keep_alive = KeepAlive :: Yes ;
@@ -525,14 +525,8 @@ impl ConnectionHandler for Handler {
525
525
break ;
526
526
}
527
527
Poll :: Ready ( Err ( e) ) => {
528
- warn ! ( "Outbound substream error while closing: {:?}" , e) ;
529
- return Poll :: Ready ( ConnectionHandlerEvent :: Close (
530
- io:: Error :: new (
531
- io:: ErrorKind :: BrokenPipe ,
532
- "Failed to close outbound substream" ,
533
- )
534
- . into ( ) ,
535
- ) ) ;
528
+ warn ! ( "Outbound substream error while closing: {e:?}" ) ;
529
+ break ;
536
530
}
537
531
Poll :: Pending => {
538
532
self . keep_alive = KeepAlive :: No ;
0 commit comments