42
42
} ,
43
43
weighted_shuffle:: WeightedShuffle ,
44
44
} ,
45
- crossbeam_channel:: { Receiver , RecvTimeoutError , Sender , TrySendError } ,
45
+ crossbeam_channel:: { Receiver , Sender , TrySendError } ,
46
46
itertools:: { Either , Itertools } ,
47
47
rand:: { seq:: SliceRandom , CryptoRng , Rng } ,
48
48
rayon:: { prelude:: * , ThreadPool , ThreadPoolBuilder } ,
@@ -2112,7 +2112,6 @@ impl ClusterInfo {
2112
2112
sender : & Sender < Vec < ( /*from:*/ SocketAddr , Protocol ) > > ,
2113
2113
packet_buf : & mut VecDeque < PacketBatch > ,
2114
2114
) -> Result < ( ) , GossipError > {
2115
- const RECV_TIMEOUT : Duration = Duration :: from_secs ( 1 ) ;
2116
2115
fn count_dropped_packets ( packets : & PacketBatch , dropped_packets_counts : & mut [ u64 ; 7 ] ) {
2117
2116
for packet in packets {
2118
2117
let k = packet
@@ -2127,7 +2126,7 @@ impl ClusterInfo {
2127
2126
let mut dropped_packets_counts = [ 0u64 ; 7 ] ;
2128
2127
let mut num_packets = 0 ;
2129
2128
for packet_batch in receiver
2130
- . recv_timeout ( RECV_TIMEOUT )
2129
+ . recv ( )
2131
2130
. map ( std:: iter:: once) ?
2132
2131
. chain ( receiver. try_iter ( ) )
2133
2132
{
@@ -2218,10 +2217,9 @@ impl ClusterInfo {
2218
2217
packet_buf : & mut VecDeque < Vec < ( /*from:*/ SocketAddr , Protocol ) > > ,
2219
2218
) -> Result < ( ) , GossipError > {
2220
2219
let _st = ScopedTimer :: from ( & self . stats . gossip_listen_loop_time ) ;
2221
- const RECV_TIMEOUT : Duration = Duration :: from_secs ( 1 ) ;
2222
2220
let mut num_packets = 0 ;
2223
2221
for pkts in receiver
2224
- . recv_timeout ( RECV_TIMEOUT )
2222
+ . recv ( )
2225
2223
. map ( std:: iter:: once) ?
2226
2224
. chain ( receiver. try_iter ( ) )
2227
2225
{
@@ -2287,8 +2285,9 @@ impl ClusterInfo {
2287
2285
& sender,
2288
2286
& mut packet_buf,
2289
2287
) {
2290
- Err ( GossipError :: RecvTimeoutError ( RecvTimeoutError :: Disconnected ) ) => break ,
2291
- Err ( GossipError :: RecvTimeoutError ( RecvTimeoutError :: Timeout ) ) => ( ) ,
2288
+ // A recv operation can only fail if the sending end of a
2289
+ // channel is disconnected.
2290
+ Err ( GossipError :: RecvError ( _) ) => break ,
2292
2291
// A send operation can only fail if the receiving end of a
2293
2292
// channel is disconnected.
2294
2293
Err ( GossipError :: SendError ) => break ,
@@ -2331,15 +2330,7 @@ impl ClusterInfo {
2331
2330
& mut packet_buf,
2332
2331
) {
2333
2332
match err {
2334
- GossipError :: RecvTimeoutError ( RecvTimeoutError :: Disconnected ) => break ,
2335
- GossipError :: RecvTimeoutError ( RecvTimeoutError :: Timeout ) => {
2336
- let table_size = self . gossip . crds . read ( ) . unwrap ( ) . len ( ) ;
2337
- debug ! (
2338
- "{}: run_listen timeout, table size: {}" ,
2339
- self . id( ) ,
2340
- table_size,
2341
- ) ;
2342
- }
2333
+ GossipError :: RecvError ( _) => break ,
2343
2334
GossipError :: DuplicateNodeInstance => {
2344
2335
error ! (
2345
2336
"duplicate running instances of the same validator node: {}" ,
0 commit comments