Hi,

I am writing an application, which uses DTLS over UDP. As I read in the
OpenSSL-dev mailinglist
(http://www.mail-archive.com/openssl-dev@openssl.org/msg28844.html)
threads are recommended when handling multiple DTLS connections. In my
case, however, when using threads, an SSL connection has to be accessed
by multiple threads. So I am thinking about introducing a mutex for each
SSL connection to prevent concurrent access by multiple threads.

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);
...

I am using OpenSSL 1.0.0d on Linux, patched with the DTLS bugfixes from
http://sctp.fh-muenster.de/dtls-patches.html



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

Reply via email to