From 11faa8149e4b7d367012e3e9193388cf4c804792 Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Thu, 17 Dec 2015 09:57:12 -0600 Subject: [PATCH] Fix blocking close with LWIP_SO_SNDTIMEO This fixes a bug in close when LWIP_SO_SNDTIMEO is enabled, but the option is not in use on the socket A simple mis-typed comparison against zero would cause the close_timeout to get set to zero if conn->send_timeout was 0 The intended check was to over-ride the default close timeout if a send timeout had been specified via SO_SNDTIMEO --- src/api/api_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/api_msg.c b/src/api/api_msg.c index fcf293a0..6ed470a0 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -886,7 +886,7 @@ lwip_netconn_do_close_internal(struct netconn *conn WRITE_DELAYED_PARAM) /* this is kind of an lwip addition to the standard sockets: we wait for some time when failing to allocate a segment for the FIN */ #if LWIP_SO_SNDTIMEO - if (conn->send_timeout >= 0) { + if (conn->send_timeout > 0) { close_timeout = conn->send_timeout; } #endif /* LWIP_SO_SNDTIMEO */