Skip to content

Commit 1ae8dad

Browse files
committed
Actually fix the logic
1 parent e2b1db6 commit 1ae8dad

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

iroh/src/magicsock.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -535,21 +535,21 @@ impl MagicSock {
535535
}
536536
}
537537

538-
let udp_pending = udp_addr.is_some()
539-
&& udp_error
540-
.as_ref()
541-
.map(|err| err.kind() == io::ErrorKind::WouldBlock)
542-
.unwrap_or_default();
538+
let udp_pending = udp_error
539+
.as_ref()
540+
.map(|err| err.kind() == io::ErrorKind::WouldBlock)
541+
.unwrap_or_default();
543542

544-
let relay_pending = relay_url.is_some()
545-
&& relay_error
546-
.as_ref()
547-
.map(|err| err.kind() == io::ErrorKind::WouldBlock)
548-
.unwrap_or_default();
543+
let relay_pending = relay_error
544+
.as_ref()
545+
.map(|err| err.kind() == io::ErrorKind::WouldBlock)
546+
.unwrap_or_default();
549547

550-
let has_path = udp_addr.is_some() || relay_url.is_some();
548+
let udp_path = udp_addr.is_some();
549+
let relay_path = relay_url.is_some();
550+
let has_path = udp_path || relay_path;
551551

552-
if udp_pending && relay_pending && has_path {
552+
if (udp_pending || !udp_path) && (relay_pending || !relay_path) && has_path {
553553
// Handle backpressure.
554554
inc!(MagicsockMetrics, send_pending);
555555
Err(io::Error::new(io::ErrorKind::WouldBlock, "pending"))

0 commit comments

Comments
 (0)