Skip to content

Commit

Permalink
Handle WantWrite and WantRead errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Aug 8, 2015
1 parent a10604e commit 69cbd14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,14 @@ impl<S> DirectStream<S> {
err
}
}
LibSslError::ErrorWantWrite => {
SslError::StreamError(io::Error::new(io::ErrorKind::TimedOut,
"socket write timed out"))
}
LibSslError::ErrorWantRead => {
SslError::StreamError(io::Error::new(io::ErrorKind::TimedOut,
"socket read timed out"))
}
err => panic!("unexpected error {:?} with ret {}", err, ret),
}
}
Expand Down

2 comments on commit 69cbd14

@jamwt
Copy link
Contributor

@jamwt jamwt commented on 69cbd14 Aug 20, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this--but if you're in an async application, this still doesn't propagate up information about whether openssl wants to read data or to write data, correct? So we still don't quite have enough information to integrate with an event loop, here.

@sfackler
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I think the right approach for non blocking IO is a separate type from SslStream which will allow it to expose the relevant information.

Please sign in to comment.