Skip to content

Commit

Permalink
add openssl async error code
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq committed Dec 20, 2023
1 parent 5176570 commit 4de0241
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openssl-sys/src/ssl.rs
Expand Up @@ -306,6 +306,8 @@ pub const SSL_ERROR_SSL: c_int = 1;
pub const SSL_ERROR_SYSCALL: c_int = 5;
pub const SSL_ERROR_WANT_ACCEPT: c_int = 8;
pub const SSL_ERROR_WANT_CONNECT: c_int = 7;
pub const SSL_ERROR_WANT_ASYNC: c_int = 9;
pub const SSL_ERROR_WANT_ASYNC_JOB: c_int = 10;
pub const SSL_ERROR_WANT_READ: c_int = 2;
pub const SSL_ERROR_WANT_WRITE: c_int = 3;
pub const SSL_ERROR_WANT_X509_LOOKUP: c_int = 4;
Expand Down
17 changes: 17 additions & 0 deletions openssl/src/ssl/error.rs
Expand Up @@ -16,6 +16,23 @@ impl ErrorCode {
/// The SSL session has been closed.
pub const ZERO_RETURN: ErrorCode = ErrorCode(ffi::SSL_ERROR_ZERO_RETURN);

/// The operation did not complete because an asynchronous engine is still
/// processing data.
///
/// This will only occur if the mode has been set to SSL_MODE_ASYNC.
///
/// Wait for async engine by using async job APIs and retry the operation.
pub const WANT_ASYNC: ErrorCode = ErrorCode(ffi::SSL_ERROR_WANT_ASYNC);

/// The asynchronous job could not be started because there were no async jobs
/// available in the pool.
///
/// This will only occur if the mode has been set to SSL_MODE_ASYNC.
///
/// Retry the operation after a currently executing asynchronous operation
/// for the current thread has completed
pub const WANT_ASYNC_JOB: ErrorCode = ErrorCode(ffi::SSL_ERROR_WANT_ASYNC_JOB);

/// An attempt to read data from the underlying socket returned `WouldBlock`.
///
/// Wait for read readiness and retry the operation.
Expand Down

0 comments on commit 4de0241

Please sign in to comment.