Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: use CRYPTO_THREADID_set_callback()
Browse files Browse the repository at this point in the history
Don't use CRYPTO_set_id_callback(), it's deprecated.
  • Loading branch information
bnoordhuis committed Aug 30, 2012
1 parent ed10340 commit 298f6bf
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/node_crypto.cc
Expand Up @@ -90,12 +90,16 @@ static Persistent<FunctionTemplate> secure_context_constructor;
static uv_rwlock_t* locks;


static unsigned long crypto_id_cb(void) {
static void crypto_threadid_cb(CRYPTO_THREADID* tid) {
unsigned long val;

#ifdef _WIN32
return (unsigned long) GetCurrentThreadId();
#else /* !_WIN32 */
return (unsigned long) pthread_self();
#endif /* !_WIN32 */
val = static_cast<unsigned long>(GetCurrentThreadId());
#else
val = static_cast<unsigned long>(pthread_self());
#endif

CRYPTO_THREADID_set_numeric(tid, val);
}


Expand Down Expand Up @@ -4498,7 +4502,7 @@ void InitCrypto(Handle<Object> target) {

crypto_lock_init();
CRYPTO_set_locking_callback(crypto_lock_cb);
CRYPTO_set_id_callback(crypto_id_cb);
CRYPTO_THREADID_set_callback(crypto_threadid_cb);

// Turn off compression. Saves memory - do it in userland.
#if !defined(OPENSSL_NO_COMP)
Expand Down

0 comments on commit 298f6bf

Please sign in to comment.