Skip to content

Commit

Permalink
Finish documentation for the ssl module
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Dec 5, 2017
1 parent c440789 commit 3207e57
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 50 deletions.
24 changes: 20 additions & 4 deletions openssl/src/ssl/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut};

use dh::Dh;
use error::ErrorStack;
use ssl::{self, HandshakeError, Ssl, SslContext, SslContextBuilder, SslMethod, SslStream,
use ssl::{self, HandshakeError, Ssl, SslRef, SslContext, SslContextBuilder, SslMethod, SslStream,
SSL_VERIFY_PEER};
use pkey::PKeyRef;
use version;
Expand Down Expand Up @@ -91,7 +91,7 @@ impl SslConnectorBuilder {
self
}

/// Consumes the builder, returning a `SslConnector`.
/// Consumes the builder, returning an `SslConnector`.
pub fn build(self) -> SslConnector {
SslConnector(self.0.build())
}
Expand Down Expand Up @@ -162,12 +162,14 @@ impl SslConnector {
pub struct ConnectConfiguration(Ssl);

impl ConnectConfiguration {
/// Returns a shared reference to the inner `Ssl`.
#[deprecated(since = "0.9.23",
note = "ConnectConfiguration now implements Deref<Target=SslRef>")]
pub fn ssl(&self) -> &Ssl {
&self.0
}

/// Returns a mutable reference to the inner `Ssl`.
#[deprecated(since = "0.9.23",
note = "ConnectConfiguration now implements DerefMut<Target=SslRef>")]
pub fn ssl_mut(&mut self) -> &mut Ssl {
&mut self.0
}
Expand Down Expand Up @@ -207,6 +209,20 @@ impl ConnectConfiguration {
}
}

impl Deref for ConnectConfiguration {
type Target = SslRef;

fn deref(&self) -> &SslRef {
&self.0
}
}

impl DerefMut for ConnectConfiguration {
fn deref_mut(&mut self) -> &mut SslRef {
&mut self.0
}
}

/// A builder for `SslAcceptor`s.
pub struct SslAcceptorBuilder(SslContextBuilder);

Expand Down
5 changes: 4 additions & 1 deletion openssl/src/ssl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use error::ErrorStack;
use ssl::MidHandshakeSslStream;

/// An SSL error.
// FIXME this is missing variants
#[derive(Debug)]
pub enum Error {
/// The SSL session has been closed by the other end
Expand Down Expand Up @@ -100,7 +101,9 @@ pub enum HandshakeError<S> {
SetupFailure(ErrorStack),
/// The handshake failed.
Failure(MidHandshakeSslStream<S>),
/// The handshake was interrupted midway through. This error will never be returned for blocking streams.
/// The handshake was interrupted midway through.
///
/// This error will never be returned for blocking streams.
// FIXME change to WouldBlock
Interrupted(MidHandshakeSslStream<S>),
}
Expand Down
Loading

0 comments on commit 3207e57

Please sign in to comment.