1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

windows check for NULL getprotobyname

From maxkaro on trac #110
https://libwebsockets.org/trac/libwebsockets/ticket/110

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2015-04-16 04:24:38 +08:00
parent 408f537975
commit d3efcd9461

View file

@ -230,6 +230,11 @@ lws_plat_set_socket_options(struct libwebsocket_context *context, int fd)
/* Disable Nagle */
optval = 1;
tcp_proto = getprotobyname("TCP");
if (!tcp_proto) {
lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO);
return 1;
}
setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, (const char *)&optval, optlen);
/* We are nonblocking... */