Skip to content

Commit 1de27de

Browse files
ghedonox
authored andcommitted
Add a few WouldBlock cases
1 parent 5a93ea0 commit 1de27de

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
@@ -24,6 +24,17 @@ impl ErrorCode {
2424
/// Wait for write readiness and retry the operation.
2525
pub const WANT_WRITE: ErrorCode = ErrorCode(ffi::SSL_ERROR_WANT_WRITE);
2626

27+
pub const WANT_X509_LOOKUP: ErrorCode = ErrorCode(ffi::SSL_ERROR_WANT_X509_LOOKUP);
28+
29+
pub const PENDING_SESSION: ErrorCode = ErrorCode(ffi::SSL_ERROR_PENDING_SESSION);
30+
31+
pub const PENDING_CERTIFICATE: ErrorCode = ErrorCode(ffi::SSL_ERROR_PENDING_CERTIFICATE);
32+
33+
pub const WANT_PRIVATE_KEY_OPERATION: ErrorCode =
34+
ErrorCode(ffi::SSL_ERROR_WANT_PRIVATE_KEY_OPERATION);
35+
36+
pub const PENDING_TICKET: ErrorCode = ErrorCode(ffi::SSL_ERROR_PENDING_TICKET);
37+
2738
/// A non-recoverable IO error occurred.
2839
pub const SYSCALL: ErrorCode = ErrorCode(ffi::SSL_ERROR_SYSCALL);
2940

@@ -80,7 +91,16 @@ impl Error {
8091
}
8192

8293
pub fn would_block(&self) -> bool {
83-
matches!(self.code, ErrorCode::WANT_READ | ErrorCode::WANT_WRITE)
94+
matches!(
95+
self.code,
96+
ErrorCode::WANT_READ
97+
| ErrorCode::WANT_WRITE
98+
| ErrorCode::WANT_X509_LOOKUP
99+
| ErrorCode::PENDING_SESSION
100+
| ErrorCode::PENDING_CERTIFICATE
101+
| ErrorCode::WANT_PRIVATE_KEY_OPERATION
102+
| ErrorCode::PENDING_TICKET
103+
)
84104
}
85105
}
86106

0 commit comments

Comments
 (0)