Disable logging. Version uses TCP_CORK option

This commit is contained in:
ftc
2023-03-14 23:30:58 +03:00
parent 9bf8c97ebf
commit 37dc90a65a
6 changed files with 21 additions and 10 deletions
+11
View File
@@ -1,5 +1,6 @@
#include "SynchronousSocket.h"
#include <netinet/tcp.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
@@ -162,8 +163,18 @@ void SynchronousSocket::SendMessage(const string & m)
{
len_s += (char)((len >> (8 * i)) & 0xFF);
}
int result = setsockopt(socket, IPPROTO_TCP, TCP_CORK, (char*)&YES, sizeof(int));
if (result < 0)
{
throw (string)("Error setting socket option");
}
Send(len_s);
Send(m);
result = setsockopt(socket, IPPROTO_TCP, TCP_CORK, (char*)&NO, sizeof(int));
if (result < 0)
{
throw (string)("Error setting socket option");
}
}