aboutsummaryrefslogtreecommitdiff
path: root/src/ssl/mod.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2014-09-05 21:52:44 -0700
committerSteven Fackler <[email protected]>2014-09-05 21:52:44 -0700
commite7e6ef5da2f96f231fabe746eafdf681224f5bc9 (patch)
tree660b9ff49966a024cb07690df7b8771b1878d26a /src/ssl/mod.rs
parentMerge pull request #39 from andrew-d/andrew-support-tls-sni (diff)
downloadrust-openssl-e7e6ef5da2f96f231fabe746eafdf681224f5bc9.tar.xz
rust-openssl-e7e6ef5da2f96f231fabe746eafdf681224f5bc9.zip
Remove failing constructor wrappers
Diffstat (limited to 'src/ssl/mod.rs')
-rw-r--r--src/ssl/mod.rs29
1 files changed, 6 insertions, 23 deletions
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<SslContext, SslError> {
+ /// Creates a new SSL context.
+ pub fn new(method: SslMethod) -> Result<SslContext, SslError> {
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<VerifyCallback>) {
@@ -302,7 +294,7 @@ impl Drop for Ssl {
}
impl Ssl {
- pub fn try_new(ctx: &SslContext) -> Result<Ssl, SslError> {
+ pub fn new(ctx: &SslContext) -> Result<Ssl, SslError> {
let ssl = unsafe { ffi::SSL_new(ctx.ctx) };
if ssl == ptr::mut_null() {
return Err(SslError::get());
@@ -480,10 +472,9 @@ impl<S: Stream> SslStream<S> {
}
}
- /// Attempts to create a new SSL stream
- pub fn try_new(ctx: &SslContext, stream: S) -> Result<SslStream<S>,
- SslError> {
- let ssl = match Ssl::try_new(ctx) {
+ /// Creates a new SSL stream
+ pub fn new(ctx: &SslContext, stream: S) -> Result<SslStream<S>, SslError> {
+ let ssl = match Ssl::new(ctx) {
Ok(ssl) => ssl,
Err(err) => return Err(err)
};
@@ -491,14 +482,6 @@ impl<S: Stream> SslStream<S> {
SslStream::new_from(ssl, stream)
}
- /// A convenience wrapper around `try_new`.
- pub fn new(ctx: &SslContext, stream: S) -> SslStream<S> {
- 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<c_int, SslError> {
loop {