Skip to content

Commit

Permalink
Merge pull request #1306 from crdumoul/master
Browse files Browse the repository at this point in the history
Add SslStream::from_raw_parts
  • Loading branch information
sfackler authored Jun 24, 2020
2 parents 164bb84 + 78c77b2 commit ff4a215
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3474,6 +3474,18 @@ impl<S: Read + Write> SslStream<S> {
}
}

/// Constructs an `SslStream` from a pointer to the underlying OpenSSL `SSL` struct.
///
/// This is useful if the handshake has already been completed elsewhere.
///
/// # Safety
///
/// The caller must ensure the pointer is valid.
pub unsafe fn from_raw_parts(ssl: *mut ffi::SSL, stream: S) -> Self {
let ssl = Ssl::from_ptr(ssl);
Self::new_base(ssl, stream)
}

/// Like `read`, but returns an `ssl::Error` rather than an `io::Error`.
///
/// It is particularly useful with a nonblocking socket, where the error value will identify if
Expand Down

0 comments on commit ff4a215

Please sign in to comment.