lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Small fix to tcp_out.c


From: art r
Subject: [lwip-devel] Small fix to tcp_out.c
Date: Wed, 23 Apr 2008 12:19:27 -0500

Greetings,

 

Looking at 1.3.0 from download dir.

 

The tcp_receive() function handles incoming packets. It tests for ‘pkt in the window’ on line 1040:

 

1040:    if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt,

1041:                  pcb->rcv_nxt + pcb->rcv_ann_wnd - 1)){

 

 

The ‘else’ is on line 1284:

 

1284:    } else {

1285:        if(!TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt,

1286:                           pcb->rcv_nxt + pcb->rcv_ann_wnd-1)){

1287:        tcp_ack_now(pcb);

 

As the test on line 1285-6 is exactly the negation of the test on 1040, it appears redundant to me.

 

This code seems be simpler with equivalent:

 

if (….) {

  …

} else {

   tcp_ack_now(…)

}

 

(I’m a believer in removing dead code and cruft whenever possible.)

 

Regard,

Art R.

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]