Use BIO for SSL connection.

This commit is contained in:
yhirose 2017-05-13 23:43:09 -04:00
parent 22f124f871
commit ba1107541e

View file

@ -1111,7 +1111,10 @@ template <typename U, typename T>
inline bool read_and_close_socket_ssl(socket_t sock, SSL_CTX* ctx, U SSL_connect_or_accept, T callback)
{
auto ssl = SSL_new(ctx);
SSL_set_fd(ssl, sock);
auto bio = BIO_new_socket(sock, BIO_NOCLOSE);
SSL_set_bio(ssl, bio, bio);
SSL_connect_or_accept(ssl);
SSLSocketStream strm(ssl);