[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Question about pcb->unsent_oversize in tcp_rexmit_rto
From: |
Axel Lin |
Subject: |
Re: [lwip-devel] Question about pcb->unsent_oversize in tcp_rexmit_rto |
Date: |
Tue, 17 Jan 2017 20:46:06 +0800 |
2017-01-17 14:16 GMT+08:00 Axel Lin <address@hidden>:
> Hi,
> While reading the code, I don't understand below logic:
> pcb->unsent_oversize will be updated only when TCP_OVERSIZE_DBGCHECK is set?
> What if TCP_OVERSIZE && !TCP_OVERSIZE_DBGCHECK, then
> if (pcb->unsent == NULL) pcb->unsent_oversize might be wrong?
Well, seg->oversize_left is set to 0 before adding seg to unacked list.
So should be no problem.
>
> 1390 void
> 1391 tcp_rexmit_rto(struct tcp_pcb *pcb)
> 1392 {
> 1393 struct tcp_seg *seg;
> 1394
> 1395 if (pcb->unacked == NULL) {
> 1396 return;
> 1397 }
> 1398
> 1399 /* Move all unacked segments to the head of the unsent queue */
> 1400 for (seg = pcb->unacked; seg->next != NULL; seg = seg->next);
> 1401 /* concatenate unsent queue after unacked queue */
> 1402 seg->next = pcb->unsent;
> 1403 #if TCP_OVERSIZE_DBGCHECK
> 1404 /* if last unsent changed, we need to update unsent_oversize */
> 1405 if (pcb->unsent == NULL) {
> 1406 pcb->unsent_oversize = seg->oversize_left;
> 1407 }
> 1408 #endif /* TCP_OVERSIZE_DBGCHECK */
> 1409 /* unsent queue is the concatenated queue (of unacked, unsent) */
> 1410 pcb->unsent = pcb->unacked;
> 1411 /* unacked queue is now empty */
> 1412 pcb->unacked = NULL;
> 1413