Hi Flo,

On Sep 28, 2011, at 5:37 PM, Flo Wohlfart wrote:

> Is it safe to call SSL_write() in thread B, while thread A is blocking
> at DTLSv1_listen() for the same SSL connection?
> 
> Here comes an example for better understanding:
> 
> THREAD A:
> ...
> while (DTLSv1_listen(ssl, &client_addr) <= 0);
> pthread_mutex_lock(&mutex);
> /* handle connection */
> pthread_mutex_unlock(&mutex);
> ...
> 
> THREAD B:
> ...
> pthread_mutex_lock(&mutex);
> SSL_write(ssl, buffer, len);
> pthread_mutex_unlock(&mutex);
> ...


This will not work, because the SSL object used for DTLSv1_listen() is not 
connected to any client. There is nothing SSL_write() could send to. 
DTLSv1_listen() will hold the SSL object until it is connected. Then you can 
use it with as many threads as you like, as long as you handle locking issues.

Best regards
Robin





______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to