Skip to content

Commit bb88afe

Browse files
committed
Merge branch 'feature/add_option_recv_rst_data_although_tcp_aborts' into 'release/v3.3'
feat(lwip): Add option to receive rest data although TCP aborts See merge request sdk/ESP8266_RTOS_SDK!1420
2 parents f7f3c55 + eb0ec09 commit bb88afe

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

components/lwip/Kconfig

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ config LWIP_GLOBAL_DATA_LINK_IRAM
2626
help
2727
Link LWIP global data(.bss .data COMMON) from DRAM to IRAM.
2828

29+
config ESP_LWIP_RECV_REST_DATA
30+
bool "Receive rest data although TCP aborts"
31+
default n
32+
help
33+
Receive rest data although TCP aborts.
34+
2935
config TCPIP_RECVMBOX_SIZE
3036
int "TCPIP task receive mail box size"
3137
default 32

components/lwip/lwip/src/api/api_lib.c

+6
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,19 @@ netconn_recv_data(struct netconn *conn, void **new_buf)
500500
#endif /* LWIP_TCP */
501501
LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);
502502

503+
#if ESP_LWIP_RECV_REST_DATA
504+
if (!sys_mbox_valid(&conn->recvmbox)) {
505+
#endif
503506
if (ERR_IS_FATAL(conn->last_err)) {
504507
/* don't recv on fatal errors: this might block the application task
505508
waiting on recvmbox forever! */
506509
/* @todo: this does not allow us to fetch data that has been put into recvmbox
507510
before the fatal error occurred - is that a problem? */
508511
return conn->last_err;
509512
}
513+
#if ESP_LWIP_RECV_REST_DATA
514+
}
515+
#endif
510516
#if LWIP_TCP
511517
#if (LWIP_UDP || LWIP_RAW)
512518
if (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP)

components/lwip/port/esp8266/include/lwipopts.h

+6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@
8282
#define ESP_NONBLOCK 0
8383
#endif
8484

85+
#ifdef CONFIG_ESP_LWIP_RECV_REST_DATA
86+
#define ESP_LWIP_RECV_REST_DATA 1
87+
#else
88+
#define ESP_LWIP_RECV_REST_DATA 0
89+
#endif
90+
8591
//#define SOCKETS_TCP_TRACE
8692

8793
#define TCP_HIGH_SPEED_RETRANSMISSION CONFIG_TCP_HIGH_SPEED_RETRANSMISSION

0 commit comments

Comments
 (0)