Oh :)
I forgot to mention that I instantiated those variables (it was like obvious 
for me). Here is the
initialization code:

int Server::TLS_init()
{
    int i;

    mutex_buf = (pthread_mutex_t*) malloc(CRYPTO_num_locks() * 
sizeof(pthread_mutex_t));
    if (mutex_buf == NULL) {
        return -1;
    }
    for (i = 0; i  <  CRYPTO_num_locks(); i ) {
        pthread_mutex_init(&mutex_buf[i], NULL);
    }
    
    CRYPTO_set_locking_callback(locking_function);
    CRYPTO_set_id_callback(id_function);
   
    SSL_library_init();
    SSL_load_error_strings();
    
    return 0;
}

int Server::TLS_cleanup()
{
    int i;

    if (mutex_buf == NULL) {
        return 0;
    }

    CRYPTO_set_locking_callback(NULL);
    CRYPTO_set_id_callback(NULL);

    for (i = 0; i  <  CRYPTO_num_locks(); i ) {
        pthread_mutex_destroy(&mutex_buf[i]);
    }
    free(mutex_buf);
    mutex_buf = NULL;

    return 0;
}

I'm calling TLS_init in server's constructor and TLS_cleanup in server's 
destructor.



-----------------------------------
Nirvana


__________________________________
Whozin  - Are you in? 
We pay  you  to read your own e-mail! 
Primul webmail adevărat în  limba română !   

Reply via email to