aboutsummaryrefslogtreecommitdiffstats
path: root/common/rdr/TLSOutStream.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/rdr/TLSOutStream.cxx')
-rw-r--r--common/rdr/TLSOutStream.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/common/rdr/TLSOutStream.cxx b/common/rdr/TLSOutStream.cxx
index 76f5dffe..7d59a9c7 100644
--- a/common/rdr/TLSOutStream.cxx
+++ b/common/rdr/TLSOutStream.cxx
@@ -82,7 +82,13 @@ size_t TLSOutStream::length()
void TLSOutStream::flush()
{
- U8* sentUpTo = start;
+ U8* sentUpTo;
+
+ // Only give GnuTLS larger chunks if corked to minimize overhead
+ if (corked && ((ptr - start) < 1024))
+ return;
+
+ sentUpTo = start;
while (sentUpTo < ptr) {
size_t n = writeTLS(sentUpTo, ptr - sentUpTo);
sentUpTo += n;
@@ -93,12 +99,22 @@ void TLSOutStream::flush()
out->flush();
}
+void TLSOutStream::cork(bool enable)
+{
+ OutStream::cork(enable);
+
+ out->cork(enable);
+}
+
void TLSOutStream::overrun(size_t needed)
{
if (needed > bufSize)
throw Exception("TLSOutStream overrun: buffer size exceeded");
+ // A cork might prevent the flush, so disable it temporarily
+ corked = false;
flush();
+ corked = true;
}
size_t TLSOutStream::writeTLS(const U8* data, size_t length)