Skip to content
Snippets Groups Projects
Commit b0eee6d5 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix pointer truncation warning in ssl init inside tests

parent ab1922cd
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#if !defined(WIN32) #if !defined(WIN32)
#include <pthread.h> #include <pthread.h>
#endif #endif
#include <thread>
#include "linden_common.h" #include "linden_common.h"
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
void init_curl(); void init_curl();
void term_curl(); void term_curl();
void ssl_thread_id_callback(CRYPTO_THREADID*); unsigned long ssl_thread_id(void);
void ssl_locking_callback(int mode, int type, const char * file, int line); void ssl_locking_callback(int mode, int type, const char * file, int line);
void usage(std::ostream & out); void usage(std::ostream & out);
...@@ -624,7 +625,7 @@ void init_curl() ...@@ -624,7 +625,7 @@ void init_curl()
} }
CRYPTO_set_locking_callback(ssl_locking_callback); CRYPTO_set_locking_callback(ssl_locking_callback);
CRYPTO_THREADID_set_callback(ssl_thread_id_callback); CRYPTO_set_id_callback(&ssl_thread_id);
} }
} }
...@@ -640,13 +641,11 @@ void term_curl() ...@@ -640,13 +641,11 @@ void term_curl()
} }
void ssl_thread_id_callback(CRYPTO_THREADID* pthreadid) //static
unsigned long ssl_thread_id(void)
{ {
#if defined(WIN32) // std::thread::id is very deliberately opaque, but we can hash it
CRYPTO_THREADID_set_pointer(pthreadid, GetCurrentThread()); return std::hash<std::thread::id>()(std::this_thread::get_id());
#else
CRYPTO_THREADID_set_pointer(pthreadid, pthread_self());
#endif
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include "llproxy.h" #include "llproxy.h"
#include "llcleanup.h" #include "llcleanup.h"
void ssl_thread_id_callback(CRYPTO_THREADID*); unsigned long ssl_thread_id(void);
void ssl_locking_callback(int mode, int type, const char * file, int line); void ssl_locking_callback(int mode, int type, const char * file, int line);
#if 0 // lltut provides main and runner #if 0 // lltut provides main and runner
...@@ -98,7 +98,7 @@ void init_curl() ...@@ -98,7 +98,7 @@ void init_curl()
} }
CRYPTO_set_locking_callback(ssl_locking_callback); CRYPTO_set_locking_callback(ssl_locking_callback);
CRYPTO_THREADID_set_callback(ssl_thread_id_callback); CRYPTO_set_id_callback(&ssl_thread_id);
} }
LLProxy::getInstance(); LLProxy::getInstance();
...@@ -118,13 +118,11 @@ void term_curl() ...@@ -118,13 +118,11 @@ void term_curl()
} }
void ssl_thread_id_callback(CRYPTO_THREADID* pthreadid) //static
unsigned long ssl_thread_id(void)
{ {
#if defined(WIN32) // std::thread::id is very deliberately opaque, but we can hash it
CRYPTO_THREADID_set_pointer(pthreadid, GetCurrentThread()); return std::hash<LLThread::id_t>()(LLThread::currentID());
#else
CRYPTO_THREADID_set_pointer(pthreadid, pthread_self());
#endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment