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

Re: TCP timeout




Hi Kevin,
I'm very sorry for the mess I was sending.
When I looked at my messaged - it is terrible.
I was using MS Outlook Express, and messed up with encoding
of my message. Now I use my Unix account. Here is my message.

void TcpAgent::newtimer(Packet* pkt)
{
        hdr_tcp *tcph = (hdr_tcp*)pkt->access(off_tcp_);
        if (pkt_seqno_ > tcph->seqno())
            set_rtx_timer();
        else
            cancel_rtx_timer();
}

Instead of set_rtx_timer(), which reschedules timer to
now+rtt_timeout(), use set_rtx_timer(offset), where
offset = now - time_sent_[(pkt->seqno_ + 1)%maxcwnd_]; //line 1***
Array time_sent_ keeps output timestamps of the packets
per window.
Then set_rtx_timer(offset) will reschedule timer to expire
at now+rtt_timeout()-offset.

The other possible way could be to set
offset=rtt_timeout()+(now-time_sent_[(pkt->seqno_ + 1)%maxcwnd_]);
and reschedule timer to now+offset in set_rtx_timer(offset);

This way retx timer will be bound to actual packets sending time
and not to the receiving time of ACK of the previous segment.
Everywhere else calls to set_rtx_timer() can be substituted to 
set_rtx_timer(0.0) (or offset=0.0 by default and leave it unchanged).
That's in case of the first version of offset.

I did a little research in this area and found that BSD 
(Stevens Vol.2, and NetBSD1.2) has it the way it currently is in NS.
Linux on the other side has it the way I described. I feel the 
second way is more correct.(What do you think?)

Going back to NS, this change will require the array time_sent_
as part of the TcpAgent class. Easiest way is to include

double* time_sent_;  //line 2***

in class definition, and

assert((time_sent_=new double[maxcwnd_?maxcwnd_:200])!=0); //line 3***

in TcpAgent::TcpAgent constructor, and

time_sent_[pkt->seqno_%maxcwnd_] = now;  //line 4***

in TcpAgent::output() just before calling the target node.
So, the actual change is only additional 4 lines of code.

One drawback of this approach is the array itself. 
Better way could be to use some kind of a linked list,
and dynamically insrease it as cwnd_ increases.

Ihor.