diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 3f442249..cb3c037e 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -26,6 +26,12 @@ config LWIP_GLOBAL_DATA_LINK_IRAM help Link LWIP global data(.bss .data COMMON) from DRAM to IRAM. +config ESP_LWIP_RECV_REST_DATA + bool "Receive rest data although TCP aborts" + default n + help + Receive rest data although TCP aborts. + config TCPIP_RECVMBOX_SIZE int "TCPIP task receive mail box size" default 32 diff --git a/components/lwip/lwip/src/api/api_lib.c b/components/lwip/lwip/src/api/api_lib.c index c428f32c..32299610 100644 --- a/components/lwip/lwip/src/api/api_lib.c +++ b/components/lwip/lwip/src/api/api_lib.c @@ -500,6 +500,9 @@ netconn_recv_data(struct netconn *conn, void **new_buf) #endif /* LWIP_TCP */ LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;); +#if ESP_LWIP_RECV_REST_DATA + if (!sys_mbox_valid(&conn->recvmbox)) { +#endif if (ERR_IS_FATAL(conn->last_err)) { /* don't recv on fatal errors: this might block the application task waiting on recvmbox forever! */ @@ -507,6 +510,9 @@ netconn_recv_data(struct netconn *conn, void **new_buf) before the fatal error occurred - is that a problem? */ return conn->last_err; } +#if ESP_LWIP_RECV_REST_DATA + } +#endif #if LWIP_TCP #if (LWIP_UDP || LWIP_RAW) if (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) diff --git a/components/lwip/port/esp8266/include/lwipopts.h b/components/lwip/port/esp8266/include/lwipopts.h index 60eaf9e7..6b592cca 100644 --- a/components/lwip/port/esp8266/include/lwipopts.h +++ b/components/lwip/port/esp8266/include/lwipopts.h @@ -82,6 +82,12 @@ #define ESP_NONBLOCK 0 #endif +#ifdef CONFIG_ESP_LWIP_RECV_REST_DATA +#define ESP_LWIP_RECV_REST_DATA 1 +#else +#define ESP_LWIP_RECV_REST_DATA 0 +#endif + //#define SOCKETS_TCP_TRACE #define TCP_HIGH_SPEED_RETRANSMISSION CONFIG_TCP_HIGH_SPEED_RETRANSMISSION