From e7e6ef5da2f96f231fabe746eafdf681224f5bc9 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 5 Sep 2014 21:52:44 -0700 Subject: Remove failing constructor wrappers --- src/ssl/mod.rs | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'src/ssl/mod.rs') diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs index 8bdfe416..85503704 100644 --- a/src/ssl/mod.rs +++ b/src/ssl/mod.rs @@ -127,8 +127,8 @@ impl Drop for SslContext { } impl SslContext { - /// Attempts to create a new SSL context. - pub fn try_new(method: SslMethod) -> Result { + /// Creates a new SSL context. + pub fn new(method: SslMethod) -> Result { init(); let ctx = unsafe { ffi::SSL_CTX_new(method.to_raw()) }; @@ -139,14 +139,6 @@ impl SslContext { Ok(SslContext { ctx: ctx }) } - /// A convenience wrapper around `try_new`. - pub fn new(method: SslMethod) -> SslContext { - match SslContext::try_new(method) { - Ok(ctx) => ctx, - Err(err) => fail!("Error creating SSL context: {}", err) - } - } - /// Configures the certificate verification method for new connections. pub fn set_verify(&mut self, mode: SslVerifyMode, verify: Option) { @@ -302,7 +294,7 @@ impl Drop for Ssl { } impl Ssl { - pub fn try_new(ctx: &SslContext) -> Result { + pub fn new(ctx: &SslContext) -> Result { let ssl = unsafe { ffi::SSL_new(ctx.ctx) }; if ssl == ptr::mut_null() { return Err(SslError::get()); @@ -480,10 +472,9 @@ impl SslStream { } } - /// Attempts to create a new SSL stream - pub fn try_new(ctx: &SslContext, stream: S) -> Result, - SslError> { - let ssl = match Ssl::try_new(ctx) { + /// Creates a new SSL stream + pub fn new(ctx: &SslContext, stream: S) -> Result, SslError> { + let ssl = match Ssl::new(ctx) { Ok(ssl) => ssl, Err(err) => return Err(err) }; @@ -491,14 +482,6 @@ impl SslStream { SslStream::new_from(ssl, stream) } - /// A convenience wrapper around `try_new`. - pub fn new(ctx: &SslContext, stream: S) -> SslStream { - match SslStream::try_new(ctx, stream) { - Ok(stream) => stream, - Err(err) => fail!("Error creating SSL stream: {}", err) - } - } - fn in_retry_wrapper(&mut self, blk: |&Ssl| -> c_int) -> Result { loop { -- cgit v1.2.3