Merge pull request #1646 from fpagliughi/minor_tweaks_nodelay

Fixed warning in Window build for TCP_NODELAY
This commit is contained in:
Ian Craggs 2026-02-13 13:43:31 +00:00 committed by GitHub
commit 6f97eca1ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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
{
#if defined(NOSIGPIPE)
int opt = 1;
{
int opt = 1;
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);
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);
}
#endif
#if !defined(NO_TCP_NODELAY)
{
int opt = 1;
socklen_t opt_size = sizeof(opt);
if (setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)) != 0)
if (setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, (void*)&opt, sizeof(opt)) != 0)
Log(LOG_ERROR, -1, "Could not set TCP_NODELAY for socket %d", *sock);
}
#endif