[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] my code loop forever in the netconn_write() function
From: |
kanprin |
Subject: |
[lwip-users] my code loop forever in the netconn_write() function |
Date: |
Mon, 21 Apr 2008 19:49:12 -0700 (PDT) |
my application works at an ask-answer mode under TCP, when I get some data
from PC, I try to answer something. when I use lwip_send(), my code loop
forever in the netconn_write(); my lwip version is 1.1.0,
it does not appear every time, just when the transmition goes for a long
time.
at this time , the stack could also ack the comming TCP data, but in the
tcp_input.c , it make some mistake when free the buf in tcp_recv():
they are:
/* We go through the ->unsent list to see if any of the segments
on the list are acknowledged by the ACK. This may seem
strange since an "unsent" segment shouldn't be acked. The
rationale is that lwIP puts all outstanding segments on the
->unsent list after a retransmission, so these segments may
in fact have been sent once. */
while (pcb->unsent != NULL &&
/*TCP_SEQ_LEQ(ntohl(pcb->unsent->tcphdr->seqno) +
TCP_TCPLEN(pcb->unsent), ackno) &&
TCP_SEQ_LEQ(ackno, pcb->snd_max)*/
TCP_SEQ_BETWEEN(ackno, ntohl(pcb->unsent->tcphdr->seqno) +
TCP_TCPLEN(pcb->unsent), pcb->snd_max)
) {
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F"
from pcb->unsent\n",
ntohl(pcb->unsent->tcphdr->seqno),
ntohl(pcb->unsent->tcphdr->seqno) +
TCP_TCPLEN(pcb->unsent)));
next = pcb->unsent;
pcb->unsent = pcb->unsent->next;
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"U16_F" ... ",
(u16_t)pcb->snd_queuelen));
//*************************************************/
//the problem appear here
//*************************************************/
pcb->snd_queuelen -= pbuf_clen(next->p);
tcp_seg_free(next);
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("%"U16_F" (after freeing unsent)\n",
(u16_t)pcb->snd_queuelen));
//**************************************************/
//I found that pcb->snd_queuelen become 255 after freeing unsent,
//so it cause ERR_MEM in the netconn_write(); how can I solve the problem
just under lwip 1.1?
//**************************************************/
if (pcb->snd_queuelen != 0) {
LWIP_ASSERT("tcp_receive: valid queue length",
pcb->unacked != NULL || pcb->unsent != NULL);
}
if (pcb->unsent != NULL) {
pcb->snd_nxt = htonl(pcb->unsent->tcphdr->seqno);
}
}
so sorry for my pool English and
thanks all for your attention!
--
View this message in context:
http://www.nabble.com/my-code-loop-forever-in-the-netconn_write%28%29-function-tp16820497p16820497.html
Sent from the lwip-users mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] my code loop forever in the netconn_write() function,
kanprin <=