From dfe1ab74382485d1969c68bc38a9aadf93f602f1 Mon Sep 17 00:00:00 2001 From: likewise Date: Thu, 21 Nov 2002 10:29:51 +0000 Subject: [PATCH] Added debug messages for corner cases of TCP states. --- src/core/tcp.c | 13 ++++++++++++- src/core/tcp_in.c | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 48204e5c..d0eee5f5 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -461,7 +461,9 @@ tcp_slowtmr(void) /* Steps through all of the active PCBs. */ prev = NULL; pcb = tcp_active_pcbs; + if (pcb == NULL) DEBUGF(TCP_DEBUG, ("tcp_slowtmr: no active pcbs")); while(pcb != NULL) { + DEBUGF(TCP_DEBUG, ("tcp_slowtmr: processing active pcb")); ASSERT("tcp_timer_coarse: active pcb->state != CLOSED", pcb->state != CLOSED); ASSERT("tcp_timer_coarse: active pcb->state != LISTEN", pcb->state != LISTEN); ASSERT("tcp_timer_coarse: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT); @@ -470,8 +472,11 @@ tcp_slowtmr(void) if(pcb->state == SYN_SENT && pcb->nrtx == TCP_SYNMAXRTX) { ++pcb_remove; - } else if(pcb->nrtx == TCP_MAXRTX) { + DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached")); + } + else if(pcb->nrtx == TCP_MAXRTX) { ++pcb_remove; + DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max DATA retries reached")); } else { ++pcb->rtime; if(pcb->unacked != NULL && pcb->rtime >= pcb->rto) { @@ -506,6 +511,7 @@ tcp_slowtmr(void) if((u32_t)(tcp_ticks - pcb->tmr) > TCP_FIN_WAIT_TIMEOUT / TCP_SLOW_INTERVAL) { ++pcb_remove; + DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in FIN-WAIT-2")); } } @@ -518,6 +524,7 @@ tcp_slowtmr(void) pcb->rto * TCP_OOSEQ_TIMEOUT) { tcp_segs_free(pcb->ooseq); pcb->ooseq = NULL; + DEBUGF(TCP_CWND_DEBUG, ("tcp: dropping OOSEQ queued data\n")); } #endif /* TCP_QUEUE_OOSEQ */ @@ -526,6 +533,7 @@ tcp_slowtmr(void) if((u32_t)(tcp_ticks - pcb->tmr) > TCP_SYN_RCVD_TIMEOUT / TCP_SLOW_INTERVAL) { ++pcb_remove; + DEBUGF(TCP_DEBUG, ("tcp_slottmr: removing pcb stuck in SYN-RCVD\n")); } } @@ -554,6 +562,7 @@ tcp_slowtmr(void) ++pcb->polltmr; if(pcb->polltmr >= pcb->pollinterval) { pcb->polltmr = 0; + DEBUGF(TCP_DEBUG, ("tcp_slottmr: polling application\n")); TCP_EVENT_POLL(pcb, err); if(err == ERR_OK) { tcp_output(pcb); @@ -957,9 +966,11 @@ tcp_pcb_purge(struct tcp_pcb *pcb) if(pcb->unacked != NULL) { DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->unacked\n")); } +#if TCP_QUEUE_OOSEQ // LW if(pcb->ooseq != NULL) { DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->ooseq\n")); } +#endif #endif /* TCP_DEBUG */ tcp_segs_free(pcb->unsent); #if TCP_QUEUE_OOSEQ diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 04d9b5e5..667473dd 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -212,7 +212,9 @@ tcp_input(struct pbuf *p, struct netif *inp) arrivals). */ if(prev != NULL) { ((struct tcp_pcb_listen *)prev)->next = lpcb->next; + // our successor is the remainder of the listening list lpcb->next = tcp_listen_pcbs; + // put this listening pcb at the head of the listening list tcp_listen_pcbs = lpcb; }