diff --git a/doc/faq/readme.rst b/doc/faq/readme.rst index 80013f443..2b4187cfe 100644 --- a/doc/faq/readme.rst +++ b/doc/faq/readme.rst @@ -93,8 +93,15 @@ This error may pop up after switching between How to clear TCP PCBs in time-wait state ? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This is needed with lwIP-v1.4, less needed with lwIP-v2 but timeout is still -too high. +This is not needed anymore: + +PCBs in time-wait state are limited to 5 and removed when that number is +exceeded. + +Ref. `lwIP-v1.4 `__, +`lwIP-v2 `__ + +For reference: Time-wait PCB state helps TCP not confusing two consecutive connections with the same (s-ip,s-port,d-ip,d-port) when the first is already closed but still diff --git a/libraries/esp8266/examples/interactive/interactive.ino b/libraries/esp8266/examples/interactive/interactive.ino index bf084c967..dba533274 100644 --- a/libraries/esp8266/examples/interactive/interactive.ino +++ b/libraries/esp8266/examples/interactive/interactive.ino @@ -85,7 +85,7 @@ void loop() { case 'n': DO(WiFi.setSleepMode(WIFI_NONE_SLEEP)); case 'l': DO(WiFi.setSleepMode(WIFI_LIGHT_SLEEP)); case 'm': DO(WiFi.setSleepMode(WIFI_MODEM_SLEEP)); - case 's': DO(WiFi.config(staticip, gateway, subnet)); - case 'D': DO(wifi_station_dhcpc_start()); + case 'S': DO(WiFi.config(staticip, gateway, subnet)); // use static address + case 's': DO(WiFi.config(0u, 0u, 0u)); // back to dhcp client } } diff --git a/tools/sdk/lib/liblwip2.a b/tools/sdk/lib/liblwip2.a index 9bfbf64aa..e57030b33 100644 Binary files a/tools/sdk/lib/liblwip2.a and b/tools/sdk/lib/liblwip2.a differ diff --git a/tools/sdk/lib/liblwip2_1460.a b/tools/sdk/lib/liblwip2_1460.a index 56588f6dd..f814b335e 100644 Binary files a/tools/sdk/lib/liblwip2_1460.a and b/tools/sdk/lib/liblwip2_1460.a differ diff --git a/tools/sdk/lwip2/builder b/tools/sdk/lwip2/builder index 2b827f842..0c0d8c2fb 160000 --- a/tools/sdk/lwip2/builder +++ b/tools/sdk/lwip2/builder @@ -1 +1 @@ -Subproject commit 2b827f842925b2daf12b67ab1ae498e58174124e +Subproject commit 0c0d8c2fb90de1fc1a956c89984b74dcdd7bf8dc diff --git a/tools/sdk/lwip2/include/gluedebug.h b/tools/sdk/lwip2/include/gluedebug.h index 025266652..ca746bf03 100644 --- a/tools/sdk/lwip2/include/gluedebug.h +++ b/tools/sdk/lwip2/include/gluedebug.h @@ -35,6 +35,7 @@ #ifdef __cplusplus extern "C" #endif +#define HAS_PHY_CAPTURE 1 void (*phy_capture) (int netif_idx, const char* data, size_t len, int out, int success); ///////////////////////////////////////////////////////////////////////////// diff --git a/tools/sdk/lwip2/include/lwip-git-hash.h b/tools/sdk/lwip2/include/lwip-git-hash.h index 19bd78b94..10954e23f 100644 --- a/tools/sdk/lwip2/include/lwip-git-hash.h +++ b/tools/sdk/lwip2/include/lwip-git-hash.h @@ -1,5 +1,5 @@ // generated by makefiles/make-lwip2-hash #ifndef LWIP_HASH_H #define LWIP_HASH_H -#define LWIP_HASH_STR "STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-7-g2b827f8" +#define LWIP_HASH_STR "STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-10-g0c0d8c2" #endif // LWIP_HASH_H diff --git a/tools/sdk/lwip2/include/lwipopts.h b/tools/sdk/lwip2/include/lwipopts.h index 1c9d0a9e0..b4cef8552 100644 --- a/tools/sdk/lwip2/include/lwipopts.h +++ b/tools/sdk/lwip2/include/lwipopts.h @@ -2997,6 +2997,7 @@ /* -------------------------------------------------- + ------------- End of original lwipopts ----------- -------------------------------------------------- */ @@ -3013,4 +3014,34 @@ struct netif; #endif LWIP_ERR_T lwip_unhandled_packet (struct pbuf* pbuf, struct netif* netif) __attribute__((weak)); +/* + -------------------------------------------------- + ----------------- TIME-WAIT tweak ---------------- + -------------------------------------------------- + port @me-no-dev time-wait tweak + https://github.com/esp8266/Arduino/commit/07f4d4c241df2c552899857f39a4295164f686f2#diff-f8258e71e25fb9985ca3799e3d8b88ecR399 +*/ + +void tcp_kill_timewait (void); +#define TCP_TW_LIMIT(l) \ + if (l) do { \ + u32_t count_plus_1 = 1; \ + struct tcp_pcb* tmp = tcp_tw_pcbs; \ + if (tmp) \ + while ((tmp = tmp->next)) \ + ++count_plus_1; \ + while (--count_plus_1 > (l)) \ + /* kill the oldest */ \ + /* pcb in TW state */ \ + tcp_kill_timewait(); \ + } while (0) + +/** + * MEMP_NUM_TCP_PCB_TIME_WAIT: the number of TCP pcbs in TIME_WAIT state. + * (requires the LWIP_TCP option, 0 = disabled) + */ +#ifndef MEMP_NUM_TCP_PCB_TIME_WAIT +#define MEMP_NUM_TCP_PCB_TIME_WAIT 5 +#endif + #endif // MYLWIPOPTS_H