mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
windows: evade unused var warnings when logs disabled
https://github.com/warmcat/libwebsockets/pull/2792
This commit is contained in:
parent
a07699d269
commit
a1cda26305
1 changed files with 13 additions and 3 deletions
|
@ -79,11 +79,13 @@ lws_plat_set_nonblocking(lws_sockfd_type fd)
|
||||||
{
|
{
|
||||||
u_long optl = 1;
|
u_long optl = 1;
|
||||||
int result = !!ioctlsocket(fd, FIONBIO, &optl);
|
int result = !!ioctlsocket(fd, FIONBIO, &optl);
|
||||||
|
#if (_LWS_ENABLED_LOGS & LLL_ERR)
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
int error = LWS_ERRNO;
|
int error = LWS_ERRNO;
|
||||||
lwsl_err("ioctlsocket FIONBIO 1 failed with error %d\n", error);
|
lwsl_err("ioctlsocket FIONBIO 1 failed with error %d\n", error);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +107,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
||||||
optval = 1;
|
optval = 1;
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
|
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
|
||||||
(const char *)&optval, optlen) < 0) {
|
(const char *)&optval, optlen) < 0) {
|
||||||
|
#if (_LWS_ENABLED_LOGS & LLL_ERR)
|
||||||
int error = LWS_ERRNO;
|
int error = LWS_ERRNO;
|
||||||
lwsl_err("setsockopt SO_KEEPALIVE 1 failed with error %d\n", error);
|
lwsl_err("setsockopt SO_KEEPALIVE 1 failed with error %d\n", error);
|
||||||
|
#endif
|
||||||
return 1;
|
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),
|
if (WSAIoctl(fd, SIO_KEEPALIVE_VALS, &alive, sizeof(alive),
|
||||||
NULL, 0, &dwBytesRet, NULL, NULL)) {
|
NULL, 0, &dwBytesRet, NULL, NULL)) {
|
||||||
|
#if (_LWS_ENABLED_LOGS & LLL_ERR)
|
||||||
int error = LWS_ERRNO;
|
int error = LWS_ERRNO;
|
||||||
lwsl_err("WSAIoctl SIO_KEEPALIVE_VALS 1 %lu %lu failed with error %d\n", alive.keepalivetime, alive.keepaliveinterval, error);
|
lwsl_err("WSAIoctl SIO_KEEPALIVE_VALS 1 %lu %lu failed with error %d\n", alive.keepalivetime, alive.keepaliveinterval, error);
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,8 +133,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
tcp_proto = getprotobyname("TCP");
|
tcp_proto = getprotobyname("TCP");
|
||||||
if (!tcp_proto) {
|
if (!tcp_proto) {
|
||||||
|
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||||
int error = LWS_ERRNO;
|
int error = LWS_ERRNO;
|
||||||
lwsl_warn("getprotobyname(\"TCP\") failed with error, falling back to 6 %d\n", error);
|
lwsl_warn("getprotobyname(\"TCP\") failed with error, falling back to 6 %d\n", error);
|
||||||
|
#endif
|
||||||
protonbr = 6; /* IPPROTO_TCP */
|
protonbr = 6; /* IPPROTO_TCP */
|
||||||
} else
|
} else
|
||||||
protonbr = tcp_proto->p_proto;
|
protonbr = tcp_proto->p_proto;
|
||||||
|
@ -137,8 +145,10 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen) ) {
|
if (setsockopt(fd, protonbr, TCP_NODELAY, (const char *)&optval, optlen) ) {
|
||||||
|
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||||
int error = LWS_ERRNO;
|
int error = LWS_ERRNO;
|
||||||
lwsl_warn("setsockopt TCP_NODELAY 1 failed with error %d\n", error);
|
lwsl_warn("setsockopt TCP_NODELAY 1 failed with error %d\n", error);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return lws_plat_set_nonblocking(fd);
|
return lws_plat_set_nonblocking(fd);
|
||||||
|
@ -149,7 +159,7 @@ lws_plat_set_socket_options_ip(lws_sockfd_type fd, uint8_t pri, int lws_flags)
|
||||||
{
|
{
|
||||||
int optval = 1, ret = 0;
|
int optval = 1, ret = 0;
|
||||||
socklen_t optlen = sizeof(optval);
|
socklen_t optlen = sizeof(optval);
|
||||||
#if !defined(LWS_WITH_NO_LOGS)
|
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||||
int en;
|
int en;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -172,7 +182,7 @@ lws_plat_set_socket_options_ip(lws_sockfd_type fd, uint8_t pri, int lws_flags)
|
||||||
if (lws_flags & LCCSCF_ALLOW_REUSE_ADDR) {
|
if (lws_flags & LCCSCF_ALLOW_REUSE_ADDR) {
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
(const void *)&optval, optlen) < 0) {
|
(const void *)&optval, optlen) < 0) {
|
||||||
#if !defined(LWS_WITH_NO_LOGS)
|
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||||
en = errno;
|
en = errno;
|
||||||
lwsl_warn("%s: unable to reuse local addresses: errno %d\n",
|
lwsl_warn("%s: unable to reuse local addresses: errno %d\n",
|
||||||
__func__, en);
|
__func__, en);
|
||||||
|
@ -184,7 +194,7 @@ lws_plat_set_socket_options_ip(lws_sockfd_type fd, uint8_t pri, int lws_flags)
|
||||||
} else {
|
} else {
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
|
if (setsockopt(fd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
|
||||||
(const void *)&optval, optlen) < 0) {
|
(const void *)&optval, optlen) < 0) {
|
||||||
#if !defined(LWS_WITH_NO_LOGS)
|
#if (_LWS_ENABLED_LOGS & LLL_WARN)
|
||||||
en = errno;
|
en = errno;
|
||||||
lwsl_warn("%s: unable to use exclusive addresses: errno %d\n",
|
lwsl_warn("%s: unable to use exclusive addresses: errno %d\n",
|
||||||
__func__, en);
|
__func__, en);
|
||||||
|
|
Loading…
Add table
Reference in a new issue