We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c1a0c4 commit 686306cCopy full SHA for 686306c
src/pinger.rs
@@ -11,6 +11,7 @@ use std::{
11
Arc,
12
},
13
task::{Context, Poll},
14
+ thread,
15
time::Duration,
16
};
17
#[cfg(feature = "stream")]
@@ -94,7 +95,15 @@ impl<V: IpVersion> Pinger<V> {
94
95
u16,
96
mpsc::UnboundedSender<(V, Instant, Instant)>,
97
> = HashMap::new();
- 'packets: while let Ok(maybe_packet) = raw_blocking.recv(&mut buf) {
98
+ 'packets: loop {
99
+ let maybe_packet = match raw_blocking.recv(&mut buf) {
100
+ Ok(maybe_packet) => maybe_packet,
101
+ Err(_err) => {
102
+ thread::yield_now();
103
+ continue 'packets;
104
+ }
105
+ };
106
+
107
match &maybe_packet {
108
Some(packet) if packet.identifier() == identifier => {
109
let recv_instant = Instant::now();
0 commit comments