diff options
| author | 2026-04-03 14:43:13 +0100 | |
|---|---|---|
| committer | 2026-04-03 14:43:13 +0100 | |
| commit | ce774a0a3d9caa96e69daf0db26936c1aa02cd6d (patch) | |
| tree | 993bf3d6e5179ee016e679106b6bd48b701c9b57 /modules/extra/ssl_openssl.cpp | |
| parent | Remove the hook type field from IOHookProvider. (diff) | |
Move a function only used by ssl_openssl into that module.
Diffstat (limited to 'modules/extra/ssl_openssl.cpp')
| -rw-r--r-- | modules/extra/ssl_openssl.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp index a95833557..9844d6f5f 100644 --- a/modules/extra/ssl_openssl.cpp +++ b/modules/extra/ssl_openssl.cpp @@ -700,6 +700,26 @@ private: return str ? str : "UNKNOWN"; } + static void FlattenSendQueue(StreamSocket::SendQueue& sendq, size_t targetsize) + { + if ((sendq.size() <= 1) || (sendq.front().length() >= targetsize)) + return; + + // Avoid multiple repeated TLS encryption invocations + // This adds a single copy of the queue, but avoids + // much more overhead in terms of system calls invoked + // by an IOHook. + std::string tmp; + tmp.reserve(std::min(targetsize, sendq.bytes())+1); + do + { + tmp.append(sendq.front()); + sendq.pop_front(); + } + while (!sendq.empty() && tmp.length() < targetsize); + sendq.push_front(tmp); + } + public: OpenSSLIOHook(const std::shared_ptr<IOHookProvider>& hookprov, StreamSocket* sock, SSL* session) : SSLIOHook(hookprov) |
