Changing an OpenSSL BIO from blocking to non-blocking mode

后端 未结 1 1001
执笔经年
执笔经年 2020-12-30 11:04

I have a multithreaded application that makes heavy use of OpenSSL in C. It is designed with the idea that all of its SSL connections are expected to block. Specifically, bl

相关标签:
1条回答
  • 2020-12-30 11:26

    I did non-blocking SSL connections in my own "lion" code, but I did not use the BIO functionality in OpenSSL at all.

    Rather, I went for the calls SSL_set_fd(ctx, fd ) and SSL_get_fd(ssl) to handle my own fdsets and calling select.

    The biggest 'gotcha' that took a while to track down was to set SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER and SSL_MODE_ENABLE_PARTIAL_WRITE for it work the way I wanted.

    If you want to read the SSL part of the code, it is here:

    https://github.com/lundman/lion/blob/master/src/tls.c

    0 讨论(0)
提交回复
热议问题