Skip to content

Commit

Permalink
impl From<StoppedError> for io::Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed May 19, 2024
1 parent 26361e4 commit 32b5565
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions quinn/src/send_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,14 @@ pub enum StoppedError {
#[error("0-RTT rejected")]
ZeroRttRejected,
}

impl From<StoppedError> for io::Error {
fn from(x: StoppedError) -> Self {
use StoppedError::*;
let kind = match x {
ZeroRttRejected => io::ErrorKind::ConnectionReset,
ConnectionLost(_) => io::ErrorKind::NotConnected,
};
Self::new(kind, x)
}
}

0 comments on commit 32b5565

Please sign in to comment.