fix bug for tcp recv assert

This commit is contained in:
xueyunfei
2020-05-11 14:03:37 +08:00
parent 68ba3db3f1
commit ab9f5864b5
2 changed files with 18 additions and 1 deletions
+16 -1
View File
@@ -65,6 +65,10 @@
/* These variables are global to all functions involved in the input
processing of TCP segments. They are set by the tcp_input()
function. */
#ifndef ESP_N0_LOG
#include "esp_log.h"
const static char *TAG = "lwip";
#endif
static struct tcp_seg inseg;
static struct tcp_hdr *tcphdr;
static u16_t tcphdr_optlen;
@@ -1502,7 +1506,18 @@ tcp_receive(struct tcp_pcb *pcb)
cseg = pcb->ooseq;
seqno = pcb->ooseq->tcphdr->seqno;
#if ESP_LWIP
if (pcb->rcv_wnd < TCP_TCPLEN(cseg)) {
ESP_LOGW(TAG,"rx_oow,s=%u,w=%u,l=%u,n=%u,l1=%u,l2=%u,f=%x,tf=%d",seqno,pcb->rcv_wnd,cseg->len,pcb->rcv_nxt,pcb->snd_wl1,pcb->snd_wl2,TCPH_FLAGS((cseg)->tcphdr),pcb->flags);
cseg->len = pcb->rcv_wnd;
if(TCPH_FLAGS((cseg)->tcphdr) & TCP_SYN) {
cseg->len -= 1;
}
pbuf_realloc(cseg->p, cseg->len);
tcp_segs_free(cseg->next);
cseg->next = NULL;
}
#endif
pcb->rcv_nxt += TCP_TCPLEN(cseg);
LWIP_ASSERT("tcp_receive: ooseq tcplen > rcv_wnd\n",
pcb->rcv_wnd >= TCP_TCPLEN(cseg));
+2
View File
@@ -34,6 +34,8 @@ limitations under the License.
#define ESP_IRAM_ATTR
#define ESP_RANDOM_TCP_PORT 0
#define ESP_GRATUITOUS_ARP 1
#define ESP_N0_LOG
#define ESP_LOGW( tag, format, ... )
#include "../lwipopts.h"