@@ -764,7 +764,7 @@ where
764
764
}
765
765
} else {
766
766
tracing:: error!( peer_id = %peer_id,
767
- "Could not PUBLISH, peer doesn't exist in connected peer list" ) ;
767
+ "Could not send PUBLISH, peer doesn't exist in connected peer list" ) ;
768
768
}
769
769
}
770
770
@@ -1066,7 +1066,7 @@ where
1066
1066
} ) ;
1067
1067
} else {
1068
1068
tracing:: error!( peer = %peer_id,
1069
- "Could not GRAFT, peer doesn't exist in connected peer list" ) ;
1069
+ "Could not send GRAFT, peer doesn't exist in connected peer list" ) ;
1070
1070
}
1071
1071
1072
1072
// If the peer did not previously exist in any mesh, inform the handler
@@ -1165,7 +1165,7 @@ where
1165
1165
peer. sender . prune ( prune) ;
1166
1166
} else {
1167
1167
tracing:: error!( peer = %peer_id,
1168
- "Could not PRUNE, peer doesn't exist in connected peer list" ) ;
1168
+ "Could not send PRUNE, peer doesn't exist in connected peer list" ) ;
1169
1169
}
1170
1170
1171
1171
// If the peer did not previously exist in any mesh, inform the handler
@@ -1344,7 +1344,7 @@ where
1344
1344
}
1345
1345
} else {
1346
1346
tracing:: error!( peer = %peer_id,
1347
- "Could not IWANT, peer doesn't exist in connected peer list" ) ;
1347
+ "Could not send IWANT, peer doesn't exist in connected peer list" ) ;
1348
1348
}
1349
1349
}
1350
1350
tracing:: trace!( peer=%peer_id, "Completed IHAVE handling for peer" ) ;
@@ -1367,7 +1367,7 @@ where
1367
1367
1368
1368
for id in iwant_msgs {
1369
1369
// If we have it and the IHAVE count is not above the threshold,
1370
- // foward the message.
1370
+ // forward the message.
1371
1371
if let Some ( ( msg, count) ) = self
1372
1372
. mcache
1373
1373
. get_with_iwant_counts ( & id, peer_id)
@@ -1407,7 +1407,7 @@ where
1407
1407
}
1408
1408
} else {
1409
1409
tracing:: error!( peer = %peer_id,
1410
- "Could not IWANT, peer doesn't exist in connected peer list" ) ;
1410
+ "Could not send IWANT, peer doesn't exist in connected peer list" ) ;
1411
1411
}
1412
1412
}
1413
1413
}
@@ -2050,8 +2050,11 @@ where
2050
2050
}
2051
2051
}
2052
2052
2053
- // remove unsubscribed peers from the mesh if it exists
2053
+ // remove unsubscribed peers from the mesh and fanout if they exist there.
2054
2054
for ( peer_id, topic_hash) in unsubscribed_peers {
2055
+ self . fanout
2056
+ . get_mut ( & topic_hash)
2057
+ . map ( |peers| peers. remove ( & peer_id) ) ;
2055
2058
self . remove_peer_from_mesh ( & peer_id, & topic_hash, None , false , Churn :: Unsub ) ;
2056
2059
}
2057
2060
@@ -2075,7 +2078,7 @@ where
2075
2078
}
2076
2079
} else {
2077
2080
tracing:: error!( peer = %propagation_source,
2078
- "Could not GRAFT, peer doesn't exist in connected peer list" ) ;
2081
+ "Could not send GRAFT, peer doesn't exist in connected peer list" ) ;
2079
2082
}
2080
2083
2081
2084
// Notify the application of the subscriptions
@@ -2093,9 +2096,12 @@ where
2093
2096
fn apply_iwant_penalties ( & mut self ) {
2094
2097
if let Some ( ( peer_score, ..) ) = & mut self . peer_score {
2095
2098
for ( peer, count) in self . gossip_promises . get_broken_promises ( ) {
2096
- peer_score. add_penalty ( & peer, count) ;
2097
- if let Some ( metrics) = self . metrics . as_mut ( ) {
2098
- metrics. register_score_penalty ( Penalty :: BrokenPromise ) ;
2099
+ // We do not apply penalties to nodes that have disconnected.
2100
+ if self . connected_peers . contains_key ( & peer) {
2101
+ peer_score. add_penalty ( & peer, count) ;
2102
+ if let Some ( metrics) = self . metrics . as_mut ( ) {
2103
+ metrics. register_score_penalty ( Penalty :: BrokenPromise ) ;
2104
+ }
2099
2105
}
2100
2106
}
2101
2107
}
@@ -2590,7 +2596,7 @@ where
2590
2596
}
2591
2597
} else {
2592
2598
tracing:: error!( peer = %peer_id,
2593
- "Could not IHAVE, peer doesn't exist in connected peer list" ) ;
2599
+ "Could not send IHAVE, peer doesn't exist in connected peer list" ) ;
2594
2600
}
2595
2601
}
2596
2602
}
@@ -2676,7 +2682,7 @@ where
2676
2682
peer. sender . prune ( prune) ;
2677
2683
} else {
2678
2684
tracing:: error!( peer = %peer_id,
2679
- "Could not PRUNE, peer doesn't exist in connected peer list" ) ;
2685
+ "Could not send PRUNE, peer doesn't exist in connected peer list" ) ;
2680
2686
}
2681
2687
2682
2688
// inform the handler
@@ -2713,8 +2719,8 @@ where
2713
2719
2714
2720
for peer_id in recipient_peers {
2715
2721
let Some ( peer) = self . connected_peers . get_mut ( peer_id) else {
2716
- tracing :: error! ( peer = %peer_id ,
2717
- "Could not IDONTWANT, peer doesn't exist in connected peer list" ) ;
2722
+ // It can be the case that promises to disconnected peers appear here. In this case
2723
+ // we simply ignore the peer-id.
2718
2724
continue ;
2719
2725
} ;
2720
2726
@@ -2979,7 +2985,7 @@ where
2979
2985
}
2980
2986
} else {
2981
2987
tracing:: error!( peer = %peer_id,
2982
- "Could not SUBSCRIBE, peer doesn't exist in connected peer list" ) ;
2988
+ "Could not send SUBSCRIBE, peer doesn't exist in connected peer list" ) ;
2983
2989
}
2984
2990
}
2985
2991
0 commit comments