/[lwip]/lwip/src/core/tcp_out.c
ViewVC logotype

Diff of /lwip/src/core/tcp_out.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.80 by goldsimon, Sun Apr 19 12:42:49 2009 UTC revision 1.81 by goldsimon, Sun Apr 26 12:27:11 2009 UTC
# Line 595  tcp_output(struct tcp_pcb *pcb) Line 595  tcp_output(struct tcp_pcb *pcb)
595        /* unacked list is not empty? */        /* unacked list is not empty? */
596        } else {        } else {
597          /* In the case of fast retransmit, the packet should not go to the tail          /* In the case of fast retransmit, the packet should not go to the tail
598           * of the unacked queue, but rather at the head. We need to check for           * of the unacked queue, but rather somewhere before it. We need to check for
599           * this case. -STJ Jul 27, 2004 */           * this case. -STJ Jul 27, 2004 */
600          if (TCP_SEQ_LT(ntohl(seg->tcphdr->seqno), ntohl(useg->tcphdr->seqno))){          if (TCP_SEQ_LT(ntohl(seg->tcphdr->seqno), ntohl(useg->tcphdr->seqno))){
601            /* add segment to head of unacked list */            /* add segment to before tail of unacked list, keeping the list sorted */
602            seg->next = pcb->unacked;            struct tcp_seg **cur_seg = &(pcb->unacked);
603            pcb->unacked = seg;            while (*cur_seg &&
604                TCP_SEQ_LT(ntohl((*cur_seg)->tcphdr->seqno), ntohl(seg->tcphdr->seqno))) {
605                  cur_seg = &((*cur_seg)->next );
606              }
607              seg->next = (*cur_seg);
608              (*cur_seg) = seg;
609          } else {          } else {
610            /* add segment to tail of unacked list */            /* add segment to tail of unacked list */
611            useg->next = seg;            useg->next = seg;
# Line 820  void Line 825  void
825  tcp_rexmit(struct tcp_pcb *pcb)  tcp_rexmit(struct tcp_pcb *pcb)
826  {  {
827    struct tcp_seg *seg;    struct tcp_seg *seg;
828      struct tcp_seg **cur_seg;
829    
830    if (pcb->unacked == NULL) {    if (pcb->unacked == NULL) {
831      return;      return;
832    }    }
833    
834    /* Move the first unacked segment to the unsent queue */    /* Move the first unacked segment to the unsent queue */
835    seg = pcb->unacked->next;    /* Keep the unsent queue sorted. */
836    pcb->unacked->next = pcb->unsent;    seg = pcb->unacked;
837    pcb->unsent = pcb->unacked;    pcb->unacked = seg->next;
838    pcb->unacked = seg;  
839      cur_seg = &(pcb->unsent);
840      while (*cur_seg &&
841        TCP_SEQ_LT(ntohl((*cur_seg)->tcphdr->seqno), ntohl(seg->tcphdr->seqno))) {
842          cur_seg = &((*cur_seg)->next );
843      }
844      seg->next = *cur_seg;
845      *cur_seg = seg;
846    
847    pcb->snd_nxt = ntohl(pcb->unsent->tcphdr->seqno);    pcb->snd_nxt = ntohl(pcb->unsent->tcphdr->seqno);
848    

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.81

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26