aboutsummaryrefslogtreecommitdiff
path: root/lib.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2013-10-23 21:28:08 -0700
committerSteven Fackler <[email protected]>2013-10-23 21:28:08 -0700
commit7ea442be94ac1450d5d9d6c5670c10b0e7a5b05a (patch)
tree989b2707a303d40d1eb9dbf7b02364c21e360e37 /lib.rs
parentSlightly better error handling (diff)
downloadrust-openssl-7ea442be94ac1450d5d9d6c5670c10b0e7a5b05a.tar.xz
rust-openssl-7ea442be94ac1450d5d9d6c5670c10b0e7a5b05a.zip
Ssl errors may return a stack
Diffstat (limited to 'lib.rs')
-rw-r--r--lib.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib.rs b/lib.rs
index a15b7964..2742a48f 100644
--- a/lib.rs
+++ b/lib.rs
@@ -98,7 +98,7 @@ impl SslContext {
let ctx = unsafe { ffi::SSL_CTX_new(method.to_raw()) };
if ctx == ptr::null() {
- return Err(SslError::get().unwrap());
+ return Err(SslError::get());
}
Ok(SslContext { ctx: ctx })
@@ -130,7 +130,7 @@ impl SslContext {
};
if ret == 0 {
- Some(SslError::get().unwrap())
+ Some(SslError::get())
} else {
None
}
@@ -151,19 +151,19 @@ impl Ssl {
fn try_new(ctx: &SslContext) -> Result<Ssl, SslError> {
let ssl = unsafe { ffi::SSL_new(ctx.ctx) };
if ssl == ptr::null() {
- return Err(SslError::get().unwrap());
+ return Err(SslError::get());
}
let ssl = Ssl { ssl: ssl };
let rbio = unsafe { ffi::BIO_new(ffi::BIO_s_mem()) };
if rbio == ptr::null() {
- return Err(SslError::get().unwrap());
+ return Err(SslError::get());
}
let wbio = unsafe { ffi::BIO_new(ffi::BIO_s_mem()) };
if wbio == ptr::null() {
unsafe { ffi::BIO_free_all(rbio) }
- return Err(SslError::get().unwrap());
+ return Err(SslError::get());
}
unsafe { ffi::SSL_set_bio(ssl.ssl, rbio, wbio) }
@@ -307,7 +307,7 @@ impl<S: Stream> SslStream<S> {
}
ErrorWantWrite => self.flush(),
ErrorZeroReturn => return Err(SslSessionClosed),
- ErrorSsl => return Err(SslError::get().unwrap()),
+ ErrorSsl => return Err(SslError::get()),
_ => unreachable!()
}
}