From 01fc6db0c5ce2dba9e94163b43e71e383bc9b2d6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 15 Mar 2018 15:45:39 -0700 Subject: [PATCH] ircd::net: Disable readahead for socket's SSL_CTX. --- ircd/net.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ircd/net.cc b/ircd/net.cc index 26c3c9445..a408aa1c7 100644 --- a/ircd/net.cc +++ b/ircd/net.cc @@ -1296,6 +1296,7 @@ ircd::net::socket::socket(asio::ssl::context &ssl, { ++count; ++instances; + SSL_set_read_ahead(this->ssl.native_handle(), false); } /// The dtor asserts that the socket is not open/connected requiring a @@ -1566,9 +1567,10 @@ ircd::net::socket::wait(const wait_opts &opts, // the wait. ASIO should fix this by adding a ssl::stream.wait() method // which will bail out immediately in this case before passing up to the // real socket wait. + assert(SSL_get_read_ahead(ssl.native_handle()) == 0); if(SSL_peek(ssl.native_handle(), buf, sizeof(buf)) > 0) { - handle(error_code{}, 1UL); + handle(error_code{}, 1UL); //TODO: stack growth here break; }