diff options
| author | Steven Fackler <[email protected]> | 2014-10-13 23:19:14 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2014-10-13 23:19:14 -0700 |
| commit | 60dce4c2190ecb935044152c02f4362d76a381e2 (patch) | |
| tree | 9be063d21a6ca4c90f20be1dd54d0dc3144b959f /src/ssl | |
| parent | Merge pull request #83 from jmesmon/set-cipher-list (diff) | |
| parent | Correct init mutexes and locking function (diff) | |
| download | rust-openssl-60dce4c2190ecb935044152c02f4362d76a381e2.tar.xz rust-openssl-60dce4c2190ecb935044152c02f4362d76a381e2.zip | |
Merge pull request #81 from vhbit/lock-init
Correct init mutexes and locking function
Diffstat (limited to 'src/ssl')
| -rw-r--r-- | src/ssl/mod.rs | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs index 86b3ec83..0ed3c2e8 100644 --- a/src/ssl/mod.rs +++ b/src/ssl/mod.rs @@ -1,8 +1,7 @@ -use libc::{c_int, c_void, c_char, c_long}; +use libc::{c_int, c_void, c_long}; use std::io::{IoResult, IoError, EndOfFile, Stream, Reader, Writer}; use std::mem; use std::ptr; -use std::rt::mutex::NativeMutex; use std::string; use sync::one::{Once, ONCE_INIT}; @@ -16,7 +15,6 @@ pub mod error; mod tests; static mut VERIFY_IDX: c_int = -1; -static mut MUTEXES: *mut Vec<NativeMutex> = 0 as *mut Vec<NativeMutex>; fn init() { static mut INIT: Once = ONCE_INIT; @@ -29,12 +27,6 @@ fn init() { None, None); assert!(verify_idx >= 0); VERIFY_IDX = verify_idx; - - let num_locks = ffi::CRYPTO_num_locks(); - let mutexes = box Vec::from_fn(num_locks as uint, |_| NativeMutex::new()); - MUTEXES = mem::transmute(mutexes); - - ffi::CRYPTO_set_locking_callback(locking_function); }); } } @@ -109,19 +101,6 @@ fn get_verify_data_idx<T>() -> c_int { } } -extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char, - _line: c_int) { - unsafe { - let mutex = (*MUTEXES).get_mut(n as uint); - - if mode & ffi::CRYPTO_LOCK != 0 { - mutex.lock_noguard(); - } else { - mutex.unlock_noguard(); - } - } -} - extern fn raw_verify(preverify_ok: c_int, x509_ctx: *mut ffi::X509_STORE_CTX) -> c_int { unsafe { |