aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/bio.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-04-16 20:57:21 -0700
committerSteven Fackler <[email protected]>2016-04-16 20:57:21 -0700
commiteadfe88b17e8c28ae0f9102e01fd5eec796d087d (patch)
treea169bf548694ab2c59d67e3297bc40595356b772 /openssl/src/ssl/bio.rs
parentMerge branch 'release-v0.7.9' into release (diff)
parentRelease v0.7.10 (diff)
downloadrust-openssl-0.7.10.tar.xz
rust-openssl-0.7.10.zip
Merge branch 'release-v0.7.10' into releasev0.7.10
Diffstat (limited to 'openssl/src/ssl/bio.rs')
-rw-r--r--openssl/src/ssl/bio.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/openssl/src/ssl/bio.rs b/openssl/src/ssl/bio.rs
index 4adbfbe2..e53545d7 100644
--- a/openssl/src/ssl/bio.rs
+++ b/openssl/src/ssl/bio.rs
@@ -82,12 +82,12 @@ unsafe fn state<'a, S: 'a>(bio: *mut BIO) -> &'a mut StreamState<S> {
}
#[cfg(feature = "nightly")]
-fn recover<F, T>(f: F) -> Result<T, Box<Any + Send>> where F: FnOnce() -> T {
- ::std::panic::recover(::std::panic::AssertRecoverSafe(f))
+fn catch_unwind<F, T>(f: F) -> Result<T, Box<Any + Send>> where F: FnOnce() -> T {
+ ::std::panic::catch_unwind(::std::panic::AssertUnwindSafe(f))
}
#[cfg(not(feature = "nightly"))]
-fn recover<F, T>(f: F) -> Result<T, Box<Any + Send>> where F: FnOnce() -> T {
+fn catch_unwind<F, T>(f: F) -> Result<T, Box<Any + Send>> where F: FnOnce() -> T {
Ok(f())
}
@@ -97,7 +97,7 @@ unsafe extern "C" fn bwrite<S: Write>(bio: *mut BIO, buf: *const c_char, len: c_
let state = state::<S>(bio);
let buf = slice::from_raw_parts(buf as *const _, len as usize);
- match recover(|| state.stream.write(buf)) {
+ match catch_unwind(|| state.stream.write(buf)) {
Ok(Ok(len)) => len as c_int,
Ok(Err(err)) => {
if retriable_error(&err) {
@@ -119,7 +119,7 @@ unsafe extern "C" fn bread<S: Read>(bio: *mut BIO, buf: *mut c_char, len: c_int)
let state = state::<S>(bio);
let buf = slice::from_raw_parts_mut(buf as *mut _, len as usize);
- match recover(|| state.stream.read(buf)) {
+ match catch_unwind(|| state.stream.read(buf)) {
Ok(Ok(len)) => len as c_int,
Ok(Err(err)) => {
if retriable_error(&err) {
@@ -154,7 +154,7 @@ unsafe extern "C" fn ctrl<S: Write>(bio: *mut BIO,
if cmd == BIO_CTRL_FLUSH {
let state = state::<S>(bio);
- match recover(|| state.stream.flush()) {
+ match catch_unwind(|| state.stream.flush()) {
Ok(Ok(())) => 1,
Ok(Err(err)) => {
state.error = Some(err);