Loading openssl/src/lib.rs +1 −1 Original line number Diff line number Diff line #![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.9")] #![cfg_attr(feature = "nightly", feature(const_fn, recover, panic_propagate))] #![cfg_attr(feature = "nightly", feature(const_fn))] #[macro_use] extern crate bitflags; Loading openssl/src/ssl/bio.rs +6 −6 Original line number Diff line number Diff line Loading @@ -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()) } Loading @@ -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) { Loading @@ -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) { Loading Loading @@ -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); Loading openssl/src/ssl/mod.rs +1 −1 Original line number Diff line number Diff line Loading @@ -1323,7 +1323,7 @@ impl<S> SslStream<S> { #[cfg(feature = "nightly")] fn check_panic(&mut self) { if let Some(err) = unsafe { bio::take_panic::<S>(self.ssl.get_raw_rbio()) } { ::std::panic::propagate(err) ::std::panic::resume_unwind(err) } } Loading Loading
openssl/src/lib.rs +1 −1 Original line number Diff line number Diff line #![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.9")] #![cfg_attr(feature = "nightly", feature(const_fn, recover, panic_propagate))] #![cfg_attr(feature = "nightly", feature(const_fn))] #[macro_use] extern crate bitflags; Loading
openssl/src/ssl/bio.rs +6 −6 Original line number Diff line number Diff line Loading @@ -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()) } Loading @@ -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) { Loading @@ -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) { Loading Loading @@ -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); Loading
openssl/src/ssl/mod.rs +1 −1 Original line number Diff line number Diff line Loading @@ -1323,7 +1323,7 @@ impl<S> SslStream<S> { #[cfg(feature = "nightly")] fn check_panic(&mut self) { if let Some(err) = unsafe { bio::take_panic::<S>(self.ssl.get_raw_rbio()) } { ::std::panic::propagate(err) ::std::panic::resume_unwind(err) } } Loading