Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add openssl async error code #2130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions openssl-sys/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ 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;
#[cfg(ossl110)]
pub const SSL_ERROR_WANT_ASYNC: c_int = 9;
#[cfg(ossl110)]
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
19 changes: 19 additions & 0 deletions openssl/src/ssl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ 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.
#[cfg(ossl110)]
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
#[cfg(ossl110)]
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