]> source.dussan.org Git - tigervnc.git/commitdiff
Expose Linux' cork functionality which allows us to aggregate TCP data in a
authorPierre Ossman <ossman@cendio.se>
Tue, 8 Nov 2011 12:10:55 +0000 (12:10 +0000)
committerPierre Ossman <ossman@cendio.se>
Tue, 8 Nov 2011 12:10:55 +0000 (12:10 +0000)
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

common/network/TcpSocket.cxx
common/network/TcpSocket.h

index 7e11588120ed7a651a289afb9a8220af43485302..23cc49bc5746e56b2cafecb7367252df5ce30e63 100644 (file)
@@ -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;
index f45c2eeb39deaa3afeb894ab717326a2e03767f3..b0bba53beddf196d8d7fd90642b1fee0712f7fca 100644 (file)
@@ -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);