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

question about TCPAgent reset()




I have a question on resetting TCPAgent and reusing it. 
the question is: how to delete those old acknowledgement packets
that still in flight in the network? 

This is important when we need to recycle old TCPAgents immediately
after the connection is closed. (like in webtraf.*). Consider the
following case: At time 1, connection 1 is set up, it transmits
100 packets, then close the session at time 10. Suppose the round
trip time is 1 second. And the last ACK packet (ACK for packet 100)
was retransmitted several times due to packet loss or extremely high
queueing delay. Then, at time 10.1, we want to set up a new
connection, but we want to reuse the TCPAgent that we just used,
so the following code is called (as in webtraf.cc/tcl):

...
    stcp = picktcp();   // load a recycled TCPAgent from some pool
    ssnk = picksnk();   // load a recycled TCPSink
...
    $stcp reset
    $ssnk reset

    $ns attach-agent $clnt $stcp
    $ns attach-agent $svr $ssnk
    $ns connect $stcp $ssnk
...

    $stcp advanceby XXX;  // XXX is the number of pkts to xmit, say 90
...

However, since the ACK packet (acking packet 100) for the previous
connection is still in flight, so as soon as $stcp starts, it
will get this ACK packet and end the session, but it hasn't
sent any packet out!

I don't know how to solve this problem, increasing the pool
size can alleviate the problem, but can not solve it. Any 
suggestions?

Guo, Liang