mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-21 20:01:46 +00:00
Free OpenSSL's record buffers of a parked TLS connection
An idle parked TLS connection took about 24 KB, most of it OpenSSL's read and write buffers. SSL_free_buffers() before parking brings it to about 15 KB; OpenSSL keeps them when a record is pending and makes new ones on the next read. The request rate is unchanged. BoringSSL, LibreSSL, Mbed TLS and wolfSSL are left as they are.
This commit is contained in:
1 parent
76e1a9c4c9
commit
7e32283df3
1 file changed
+9
@@ -20177,6 +20177,15 @@ struct SSLServer::TlsConnection final : Server::KeepAliveConnection {
|
||||
return serve_on(strm, [this](Request &req) { req.ssl = session; });
|
||||
}
|
||||
|
||||
void release_buffers() override {
|
||||
#if defined(CPPHTTPLIB_OPENSSL_SUPPORT) && !defined(OPENSSL_IS_BORINGSSL) && \
|
||||
!defined(LIBRESSL_VERSION_NUMBER)
|
||||
// The record buffers are most of an idle session's memory. It keeps them
|
||||
// when a record is still pending, and makes new ones on the next read.
|
||||
SSL_free_buffers(static_cast<SSL *>(session));
|
||||
#endif
|
||||
}
|
||||
|
||||
void shut_down(bool graceful) override { tls::shutdown(session, graceful); }
|
||||
|
||||
SSLServer &ssl_svr;
|
||||
|
||||
Reference in new issue
Block a user