Skip to content

Commit 2b71560

Browse files
ghedonox
authored andcommitted
Add a few WouldBlock cases
1 parent bc4dd56 commit 2b71560

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

boring/src/ssl/error.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ impl ErrorCode {
2727
/// Wait for write readiness and retry the operation.
2828
pub const WANT_WRITE: ErrorCode = ErrorCode(ffi::SSL_ERROR_WANT_WRITE);
2929

30+
pub const WANT_X509_LOOKUP: ErrorCode = ErrorCode(ffi::SSL_ERROR_WANT_X509_LOOKUP);
31+
32+
pub const PENDING_SESSION: ErrorCode = ErrorCode(ffi::SSL_ERROR_PENDING_SESSION);
33+
34+
pub const PENDING_CERTIFICATE: ErrorCode = ErrorCode(ffi::SSL_ERROR_PENDING_CERTIFICATE);
35+
36+
pub const WANT_PRIVATE_KEY_OPERATION: ErrorCode =
37+
ErrorCode(ffi::SSL_ERROR_WANT_PRIVATE_KEY_OPERATION);
38+
39+
pub const PENDING_TICKET: ErrorCode = ErrorCode(ffi::SSL_ERROR_PENDING_TICKET);
40+
3041
/// A non-recoverable IO error occurred.
3142
pub const SYSCALL: ErrorCode = ErrorCode(ffi::SSL_ERROR_SYSCALL);
3243

@@ -83,7 +94,16 @@ impl Error {
8394
}
8495

8596
pub fn would_block(&self) -> bool {
86-
matches!(self.code, ErrorCode::WANT_READ | ErrorCode::WANT_WRITE)
97+
matches!(
98+
self.code,
99+
ErrorCode::WANT_READ
100+
| ErrorCode::WANT_WRITE
101+
| ErrorCode::WANT_X509_LOOKUP
102+
| ErrorCode::PENDING_SESSION
103+
| ErrorCode::PENDING_CERTIFICATE
104+
| ErrorCode::WANT_PRIVATE_KEY_OPERATION
105+
| ErrorCode::PENDING_TICKET
106+
)
87107
}
88108
}
89109

0 commit comments

Comments
 (0)