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
diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx
index 7e11588..23cc49b 100644
--- a/common/network/TcpSocket.cxx
+++ b/common/network/TcpSocket.cxx
@@ -309,6 +309,17 @@
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;