summaryrefslogtreecommitdiffstats
path: root/common/network
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2011-11-08 12:10:55 +0000
committerPierre Ossman <ossman@cendio.se>2011-11-08 12:10:55 +0000
commit64069a92ef7a29c32a854f04f0d2a2371c9e67fe (patch)
tree38ab13910074a03c0aaa3ac0710823bfde653570 /common/network
parent5c9e1e51c10a9e037f99496b0996317e29b428c3 (diff)
downloadtigervnc-64069a92ef7a29c32a854f04f0d2a2371c9e67fe.tar.gz
tigervnc-64069a92ef7a29c32a854f04f0d2a2371c9e67fe.zip
Expose Linux' cork functionality which allows us to aggregate TCP data in a
controlled manner. Unfortunately there is no equivalent for Windows. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4781 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/network')
-rw-r--r--common/network/TcpSocket.cxx11
-rw-r--r--common/network/TcpSocket.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx
index 7e115881..23cc49bc 100644
--- a/common/network/TcpSocket.cxx
+++ b/common/network/TcpSocket.cxx
@@ -309,6 +309,17 @@ bool TcpSocket::enableNagles(int sock, bool enable) {
return true;
}
+bool TcpSocket::cork(int sock, bool enable) {
+#ifndef TCP_CORK
+ return false;
+#else
+ int one = enable ? 1 : 0;
+ if (setsockopt(sock, IPPROTO_TCP, TCP_CORK, (char *)&one, sizeof(one)) < 0)
+ return false;
+ return true;
+#endif
+}
+
bool TcpSocket::isSocket(int sock)
{
struct sockaddr_in info;
diff --git a/common/network/TcpSocket.h b/common/network/TcpSocket.h
index f45c2eeb..b0bba53b 100644
--- a/common/network/TcpSocket.h
+++ b/common/network/TcpSocket.h
@@ -56,6 +56,7 @@ namespace network {
virtual void shutdown();
static bool enableNagles(int sock, bool enable);
+ static bool cork(int sock, bool enable);
static bool isSocket(int sock);
static bool isConnected(int sock);
static int getSockPort(int sock);