From 891db584c1e7706e3075cea454f639ff3272c2a3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 26 Nov 2016 08:45:57 -0800 Subject: Push init synchronization to sys layer --- src/lib.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index cf05eb5..2c60572 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,7 +133,6 @@ extern crate libc; #[macro_use] extern crate bitflags; use std::ffi::CStr; -use std::sync::{Once, ONCE_INIT}; pub use agent::{Agent, Identities, PublicKey}; pub use channel::{Channel, ExitSignal, ReadWindow, WriteWindow, Stream}; @@ -164,22 +163,7 @@ mod util; /// /// This is optional, it is lazily invoked. pub fn init() { - static INIT: Once = ONCE_INIT; - INIT.call_once(|| unsafe { - platform_init(); - assert_eq!(raw::libssh2_init(raw::LIBSSH2_INIT_NO_CRYPTO), 0); - assert_eq!(libc::atexit(shutdown), 0); - }); - extern fn shutdown() { unsafe { raw::libssh2_exit(); } } - - #[cfg(unix)] - fn platform_init() { - extern crate openssl_sys; - openssl_sys::init(); - } - - #[cfg(windows)] - fn platform_init() {} + raw::init(); } unsafe fn opt_bytes<'a, T>(_: &'a T, -- cgit v1.2.3