Skip to content

Commit efb117e

Browse files
authored
fix(ping): remove debug_assert on protocol negotiation timeout
The negotiation of the ping protocol can timeout, thus a debug_assert is not correct. Return an `std::io::Error` instead. Pull-Request: #3995.
1 parent a8a00e7 commit efb117e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

protocols/ping/src/handler.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,12 @@ impl Handler {
196196
return;
197197
}
198198
// Note: This timeout only covers protocol negotiation.
199-
StreamUpgradeError::Timeout => {
200-
debug_assert!(false, "ReadyUpgrade cannot time out");
201-
return;
202-
}
199+
StreamUpgradeError::Timeout => Failure::Other {
200+
error: Box::new(std::io::Error::new(
201+
std::io::ErrorKind::TimedOut,
202+
"ping protocol negotiation timed out",
203+
)),
204+
},
203205
StreamUpgradeError::Apply(e) => void::unreachable(e),
204206
StreamUpgradeError::Io(e) => Failure::Other { error: Box::new(e) },
205207
};

0 commit comments

Comments
 (0)