mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-29 00:32:51 +00:00
don't fail closing a socket/netconn when failing to allocate the FIN segment; blocking the calling thread for a while is better than risking leaking a netconn/socket (see bug #46701)
Signed-off-by: sg <goldsimon@gmx.de>
This commit is contained in:
parent
b24e5cd1c8
commit
93ccba9bcb
@ -18,7 +18,7 @@ HISTORY
|
|||||||
|
|
||||||
2015-11-12: Dirk Ziegelmeier
|
2015-11-12: Dirk Ziegelmeier
|
||||||
* Implement possibility to declare private memory pools. This is useful to
|
* Implement possibility to declare private memory pools. This is useful to
|
||||||
decouple some apps from the core (SNMP stack) or make contrib app useage
|
decouple some apps from the core (SNMP stack) or make contrib app usage
|
||||||
simpler (httpserver_raw)
|
simpler (httpserver_raw)
|
||||||
|
|
||||||
2015-10-09: Simon Goldschmidt
|
2015-10-09: Simon Goldschmidt
|
||||||
@ -302,6 +302,11 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2013-03-17: Joel Cunningham
|
||||||
|
* api_msg.c: don't fail closing a socket/netconn when failing to allocate the
|
||||||
|
FIN segment; blocking the calling thread for a while is better than risking
|
||||||
|
leaking a netconn/socket (see bug #46701)
|
||||||
|
|
||||||
2013-03-16: Joel Cunningham
|
2013-03-16: Joel Cunningham
|
||||||
* tcp_out.c: reset rto timer on fast retransmission
|
* tcp_out.c: reset rto timer on fast retransmission
|
||||||
|
|
||||||
|
@ -884,17 +884,13 @@ lwip_netconn_do_close_internal(struct netconn *conn WRITE_DELAYED_PARAM)
|
|||||||
#endif /* LWIP_SO_LINGER */
|
#endif /* LWIP_SO_LINGER */
|
||||||
} else {
|
} else {
|
||||||
if (err == ERR_MEM) {
|
if (err == ERR_MEM) {
|
||||||
/* Closing failed because of memory shortage */
|
/* Closing failed because of memory shortage, try again later. Even for
|
||||||
if (netconn_is_nonblocking(conn)) {
|
nonblocking netconns, we have to wait since no standard socket application
|
||||||
/* Nonblocking close failed */
|
is prepared for close failing because of resource shortage.
|
||||||
close_finished = 1;
|
Check the timeout: this is kind of an lwip addition to the standard sockets:
|
||||||
err = ERR_WOULDBLOCK;
|
we wait for some time when failing to allocate a segment for the FIN */
|
||||||
} else {
|
|
||||||
/* Blocking close, check the timeout */
|
|
||||||
#if LWIP_SO_SNDTIMEO || LWIP_SO_LINGER
|
#if LWIP_SO_SNDTIMEO || LWIP_SO_LINGER
|
||||||
s32_t close_timeout = LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT;
|
s32_t close_timeout = LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT;
|
||||||
/* 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 LWIP_SO_SNDTIMEO
|
||||||
if (conn->send_timeout > 0) {
|
if (conn->send_timeout > 0) {
|
||||||
close_timeout = conn->send_timeout;
|
close_timeout = conn->send_timeout;
|
||||||
@ -917,7 +913,6 @@ lwip_netconn_do_close_internal(struct netconn *conn WRITE_DELAYED_PARAM)
|
|||||||
err = ERR_OK;
|
err = ERR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* Closing failed for a non-memory error: give up */
|
/* Closing failed for a non-memory error: give up */
|
||||||
close_finished = 1;
|
close_finished = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user