mirror of https://github.com/eclipse/paho.mqtt.c
Fixed warning in Window build for TCP_NODELAY
This commit is contained in:
parent
fa7c02e9f5
commit
4ab5e089bb
13
src/Socket.c
13
src/Socket.c
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue