aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2011-11-15 12:11:32 +0000
committerPierre Ossman <ossman@cendio.se>2011-11-15 12:11:32 +0000
commit36dadf85f410f1de283b1e363aa06d8a320834d8 (patch)
tree7facfa93edb103aa87e8722d230e73dd25ca70e3 /common
parent1b478e517749ba0a426fa4dd5a3b5ec8c502c7d8 (diff)
downloadtigervnc-36dadf85f410f1de283b1e363aa06d8a320834d8.tar.gz
tigervnc-36dadf85f410f1de283b1e363aa06d8a320834d8.zip
Cork the connection around updates to better use the congestion window
as we might send out multiple small packets git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4804 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common')
-rw-r--r--common/rfb/VNCSConnectionST.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index bd93d633..d0cdf869 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -962,13 +962,18 @@ void VNCSConnectionST::writeFramebufferUpdate()
return;
}
+ // In continuous mode, we will be outputting at least three distinct
+ // messages. We need to aggregate these in order to not clog up TCP's
+ // congestion window.
+ network::TcpSocket::cork(sock->getFd(), true);
+
// First take care of any updates that cannot contain framebuffer data
// changes.
if (writer()->needNoDataUpdate()) {
writer()->writeNoDataUpdate();
requested.clear();
if (!continuousUpdates)
- return;
+ goto out;
}
updates.enable_copyrect(cp.useCopyRect);
@@ -977,7 +982,7 @@ void VNCSConnectionST::writeFramebufferUpdate()
// anything right now (the framebuffer might have changed in ways we
// haven't yet been informed of).
if (!server->checkUpdate())
- return;
+ goto out;
// Get the lists of updates. Prior to exporting the data to the `ui' object,
// getUpdateInfo() will normalize the `updates' object such way that its
@@ -1017,7 +1022,7 @@ void VNCSConnectionST::writeFramebufferUpdate()
// Return if there is nothing to send the client.
if (updates.is_empty() && !writer()->needFakeUpdate() && !drawRenderedCursor)
- return;
+ goto out;
// The `updates' object could change, make sure we have valid update info.
@@ -1090,6 +1095,9 @@ void VNCSConnectionST::writeFramebufferUpdate()
requested.clear();
}
+
+out:
+ network::TcpSocket::cork(sock->getFd(), false);
}