Skip to content

Commit

Permalink
fix: BIO_set_retry_write when BIO_CTRL_FLUSH to allow writer returns …
Browse files Browse the repository at this point in the history
…WouldBlock on flush
  • Loading branch information
ihciah committed May 11, 2023
1 parent 7cfe206 commit c8daeb8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions boring/src/ssl/bio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,13 @@ unsafe extern "C" fn ctrl<S: Write>(
let state = state::<S>(bio);

if cmd == BIO_CTRL_FLUSH {
BIO_clear_retry_flags(bio);
match catch_unwind(AssertUnwindSafe(|| state.stream.flush())) {
Ok(Ok(())) => 1,
Ok(Err(err)) => {
if retriable_error(&err) {
BIO_set_retry_write(bio);
}
state.error = Some(err);
0
}
Expand Down

0 comments on commit c8daeb8

Please sign in to comment.