Revert "Support the dynlock API"
This reverts commit af1a056788.
This seems to cause Travis to segfault every once in a while. I've never
been able to reproduce the instability locally, so I'm just going to
pull this.
This commit is contained in:
parent
1fd8efd028
commit
0c1e4194f5
12
ssl/ffi.rs
12
ssl/ffi.rs
|
|
@ -101,14 +101,10 @@ pub static XN_FLAG_MULTILINE: c_ulong = 0x2a40006;
|
|||
#[link(name="crypto")]
|
||||
extern "C" {
|
||||
pub fn CRYPTO_num_locks() -> c_int;
|
||||
pub fn CRYPTO_set_locking_callback(
|
||||
func: extern fn(mode: c_int, n: c_int, file: *c_char, line: c_int));
|
||||
pub fn CRYPTO_set_dynlock_create_callback(
|
||||
func: extern fn(file: *c_char, line: c_int) -> *c_void);
|
||||
pub fn CRYPTO_set_dynlock_lock_callback(
|
||||
func: extern fn(mode: c_int, l: *c_void, file: *c_char, line: c_int));
|
||||
pub fn CRYPTO_set_dynlock_destroy_callback(
|
||||
func: extern fn(l: *c_void, file: *c_char, line: c_int));
|
||||
pub fn CRYPTO_set_locking_callback(func: extern "C" fn(mode: c_int,
|
||||
n: c_int,
|
||||
file: *c_char,
|
||||
line: c_int));
|
||||
|
||||
pub fn ERR_get_error() -> c_ulong;
|
||||
|
||||
|
|
|
|||
32
ssl/mod.rs
32
ssl/mod.rs
|
|
@ -40,9 +40,6 @@ fn init() {
|
|||
MUTEXES = cast::transmute(mutexes);
|
||||
|
||||
ffi::CRYPTO_set_locking_callback(locking_function);
|
||||
ffi::CRYPTO_set_dynlock_create_callback(dyn_create_function);
|
||||
ffi::CRYPTO_set_dynlock_lock_callback(dyn_lock_function);
|
||||
ffi::CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -90,28 +87,15 @@ pub enum SslVerifyMode {
|
|||
}
|
||||
|
||||
extern fn locking_function(mode: c_int, n: c_int, _file: *c_char,
|
||||
_line: c_int) {
|
||||
unsafe { inner_lock(mode, (*MUTEXES).get_mut(n as uint)); }
|
||||
}
|
||||
_line: c_int) {
|
||||
unsafe {
|
||||
let mutex = (*MUTEXES).get_mut(n as uint);
|
||||
|
||||
extern fn dyn_create_function(_file: *c_char, _line: c_int) -> *c_void {
|
||||
unsafe { cast::transmute(~NativeMutex::new()) }
|
||||
}
|
||||
|
||||
extern fn dyn_lock_function(mode: c_int, l: *c_void, _file: *c_char,
|
||||
_line: c_int) {
|
||||
unsafe { inner_lock(mode, cast::transmute(l)); }
|
||||
}
|
||||
|
||||
extern fn dyn_destroy_function(l: *c_void, _file: *c_char, _line: c_int) {
|
||||
unsafe { let _mutex: ~NativeMutex = cast::transmute(l); }
|
||||
}
|
||||
|
||||
unsafe fn inner_lock(mode: c_int, lock: &mut NativeMutex) {
|
||||
if mode & ffi::CRYPTO_LOCK != 0 {
|
||||
lock.lock_noguard();
|
||||
} else {
|
||||
lock.unlock_noguard();
|
||||
if mode & ffi::CRYPTO_LOCK != 0 {
|
||||
mutex.lock_noguard();
|
||||
} else {
|
||||
mutex.unlock_noguard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue