I am currently writing a client using OpenSSL. Ideally the client has e.g. 4 threads that waits to read from server, when one thread reads, it may perform some work, then write to the server and return in line to read from the server.
The OpenSSL documentation states that I can not use SSL_read() and SSL_write() from different threads. However SSL_read()is a blocking call, and I can not SSL_write() until it returns? I know I could use select to and do a non-blocking SSL_read() but I find this solution less optimal.
OpenSSL further complicates the issue by stating that SSL_write() can return SSL_ERROR_WANT_READ. If all threads wants to write, then this would cause a dead-lock.
My question is: if I was to use a separate input and output BIO on the SSL-connection instead, would it be possible to do a blocking read from the input BIO while another thread was writing to the output BIO?
Any other suggestions are welcome, I have also looked at the gnutls, which supports writing and reading to the same session from multiple threads.
SSL_read()being a blocking call means that it blocks, not that you can't call other functions concurrenctly. Your statement about a deadlock is therefore also a non sequitur. Unclear what you're asking. - user207421