Fixed warning in Window build for TCP_NODELAY

This commit is contained in:
fpagliughi 2026-02-13 00:59:48 -06:00
parent fa7c02e9f5
commit 4ab5e089bb
1 changed files with 7 additions and 6 deletions

View File

@ -1457,17 +1457,18 @@ int Socket_new(const char* addr, size_t addr_len, int port, SOCKET* sock)
else else
{ {
#if defined(NOSIGPIPE) #if defined(NOSIGPIPE)
int opt = 1; {
int opt = 1;
if (setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, (void*)&opt, sizeof(opt)) != 0) if (setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, (void*)&opt, sizeof(opt)) != 0)
Log(LOG_ERROR, -1, "Could not set SO_NOSIGPIPE for socket %d", *sock); Log(LOG_ERROR, -1, "Could not set SO_NOSIGPIPE for socket %d", *sock);
}
#endif #endif
#if !defined(NO_TCP_NODELAY) #if !defined(NO_TCP_NODELAY)
{ {
int opt = 1; int opt = 1;
socklen_t opt_size = sizeof(opt);
if (setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, (void*)&opt, sizeof(opt)) != 0)
if (setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)) != 0)
Log(LOG_ERROR, -1, "Could not set TCP_NODELAY for socket %d", *sock); Log(LOG_ERROR, -1, "Could not set TCP_NODELAY for socket %d", *sock);
} }
#endif #endif