Skip to content

Commit

Permalink
fix: check for ErrorKind::WouldBlock in MidHandshake::SendAlert poll (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbr authored Mar 6, 2024
1 parent 9fab4e2 commit 4a4a448
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/common/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ where
mut alert,
error,
} => {
let mut writer = SyncWriteAdapter { io: &mut io, cx };
let _ = alert.write(&mut writer); // best effort
return Poll::Ready(Err((error, io)));
return match alert.write(&mut SyncWriteAdapter { io: &mut io, cx }) {
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
*this = MidHandshake::SendAlert { io, error, alert };
Poll::Pending
}
_ => Poll::Ready(Err((error, io))),
};
}
// Starting the handshake returned an error; fail the future immediately.
MidHandshake::Error { io, error } => return Poll::Ready(Err((error, io))),
Expand Down

0 comments on commit 4a4a448

Please sign in to comment.