From a5b863f1fd5de2b6d9a1fcae25f5b35716a6c52f Mon Sep 17 00:00:00 2001 From: lotodore Date: Thu, 19 Dec 2013 11:08:16 +0100 Subject: [PATCH] Fix for libgcrypt 1.6.0 compile error #247 (Linux only, probably does not work on Windows). --- src/net/common/socket_startup.cpp | 42 +++---------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/src/net/common/socket_startup.cpp b/src/net/common/socket_startup.cpp index 12e86041..0b9c2dae 100644 --- a/src/net/common/socket_startup.cpp +++ b/src/net/common/socket_startup.cpp @@ -29,48 +29,12 @@ * as that of the covered work. * *****************************************************************************/ -#include -#include - #include #include #ifndef HAVE_OPENSSL - -extern "C" { - - int gcry_bthread_init() - { - return 0; - } - int gcry_bmutex_init(void **obj) - { - *obj = (void*)(new boost::mutex); - return 0; - } - int gcry_bmutex_destroy(void **obj) - { - delete (boost::mutex *)(*obj); - return 0; - } - int gcry_bmutex_lock(void **obj) - { - ((boost::mutex *)(*obj))->lock(); - return 0; - } - int gcry_bmutex_unlock(void **obj) - { - ((boost::mutex *)(*obj))->unlock(); - return 0; - } - - struct gcry_thread_cbs gcry_threads_boost = { - GCRY_THREAD_OPTION_USER, gcry_bthread_init, gcry_bmutex_init, - gcry_bmutex_destroy, gcry_bmutex_lock, gcry_bmutex_unlock, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL - }; -} -#endif // not HAVE_OPENSSL +GCRY_THREAD_OPTION_PTHREAD_IMPL; +#endif bool socket_startup() @@ -78,8 +42,8 @@ socket_startup() #ifdef HAVE_OPENSSL return SSL_library_init() == 1; #else + gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); gcry_check_version(NULL); - gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_boost); gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0); gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); return true;