mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
windows: evade unused var warnings when logs disabled
https://github.com/warmcat/libwebsockets/pull/2792
This commit is contained in:
parent
59d42bcc74
commit
cd8fb61f3b
1 changed files with 10 additions and 0 deletions
|
@ -79,11 +79,13 @@ lws_plat_set_nonblocking(lws_sockfd_type fd)
|
|||
{
|
||||
u_long optl = 1;
|
||||
int result = !!ioctlsocket(fd, FIONBIO, &optl);
|
||||
#if (_LWS_ENABLED_LOGS & LLL_ERR)
|
||||
if (result)
|
||||
{
|
||||
int error = LWS_ERRNO;
|
||||
lwsl_err("ioctlsocket FIONBIO 1 failed with error %d\n", error);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -105,8 +107,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
|||
optval = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(const char *)&optval, optlen) < 0) {
|
||||
#if (_LWS_ENABLED_LOGS & LLL_ERR)
|
||||
int error = LWS_ERRNO;
|
||||
lwsl_err("setsockopt SO_KEEPALIVE 1 failed with error %d\n", error);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -116,8 +120,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
|||
|
||||
if (WSAIoctl(fd, SIO_KEEPALIVE_VALS, &alive, sizeof(alive),
|
||||
NULL, 0, &dwBytesRet, NULL, NULL)) {
|
||||
#if (_LWS_ENABLED_LOGS & LLL_ERR)
|
||||
int error = LWS_ERRNO;
|
||||
lwsl_err("WSAIoctl SIO_KEEPALIVE_VALS 1 %lu %lu failed with error %d\n", alive.keepalivetime, alive.keepaliveinterval, error);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -127,8 +133,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
|||
#ifndef _WIN32_WCE
|
||||
tcp_proto = getprotobyname("TCP");
|
||||
if (!tcp_proto) {
|
||||
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||
int error = LWS_ERRNO;
|
||||
lwsl_warn("getprotobyname(\"TCP\") failed with error, falling back to 6 %d\n", error);
|
||||
#endif
|
||||
protonbr = 6; /* IPPROTO_TCP */
|
||||
} else
|
||||
protonbr = tcp_proto->p_proto;
|
||||
|
@ -137,8 +145,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
|||
#endif
|
||||
|
||||
if (setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen) ) {
|
||||
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||
int error = LWS_ERRNO;
|
||||
lwsl_warn("setsockopt TCP_NODELAY 1 failed with error %d\n", error);
|
||||
#endif
|
||||
}
|
||||
|
||||
return lws_plat_set_nonblocking(fd);
|
||||
|
|
Loading…
Add table
Reference in a new issue