TIME_WAIT sockets fixes (#1838)
* Enable SO_REUSEADDR for server TCP sockets * Reduce TCP_MSL to 5 sec * Add changes notice for future updates * Move MSL change to lwipiots.h
This commit is contained in:
parent
925991715f
commit
2f00c1d8d9
|
@ -899,6 +899,15 @@
|
|||
#define TCP_TTL (IP_DEFAULT_TTL)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TCP_MSL: Maximum segment lifetime
|
||||
* Override for <tcp_impl.h> file
|
||||
* See https://github.com/nodemcu/nodemcu-firmware/issues/1836 for details
|
||||
*/
|
||||
#ifndef TCP_MSL
|
||||
#define TCP_MSL 5000UL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TCP_MAXRTX: Maximum number of retransmissions of data segments.
|
||||
*/
|
||||
|
@ -1455,7 +1464,8 @@
|
|||
* SO_REUSE==1: Enable SO_REUSEADDR option.
|
||||
*/
|
||||
#ifndef SO_REUSE
|
||||
#define SO_REUSE 0
|
||||
/* See https://github.com/nodemcu/nodemcu-firmware/issues/1836 for details */
|
||||
#define SO_REUSE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -386,6 +386,7 @@ int net_listen( lua_State *L ) {
|
|||
ud->tcp_pcb = tcp_new();
|
||||
if (!ud->tcp_pcb)
|
||||
return luaL_error(L, "cannot allocate PCB");
|
||||
ud->tcp_pcb->so_options |= SOF_REUSEADDR;
|
||||
err = tcp_bind(ud->tcp_pcb, &addr, port);
|
||||
if (err == ERR_OK) {
|
||||
tcp_arg(ud->tcp_pcb, ud);
|
||||
|
|
Loading…
Reference in New Issue