ns-allinone-2.35/ns-2.35/baytcp/tcp-full-bay.cc
void BayFullTcpAgent::newack(Packet* pkt)
{
    hdr_tcp *tcph = hdr_tcp::access(pkt);

	register int ackno = tcph->ackno();

	// we were timing the segment and we
	// got an ACK for it
	if (rtt_active_ && ackno >= rtt_seq_) {
		/* got a rtt sample */
		rtt_active_ = FALSE;	// no longer timing
		t_backoff_ = 1;		// stop exp backoff
	}

	/* always with timestamp option */
	double tao = now() - tcph->ts();
	rtt_update(tao);

	if (ackno >= maxseq_)
		cancel_rtx_timeout();
	else {
		if (ackno > highest_ack_) {
			set_rtx_timer();
		}
	}

	// advance the ack number if this is for new data
	if (ackno > highest_ack_)
		highest_ack_ = ackno;
	// set up the next packet to send
	if (t_seqno_ < highest_ack_)
		t_seqno_ = highest_ack_;	// thing to send next
}
/*
 * Process an ACK
 *	this version of the routine doesn't necessarily
 *	require the ack to be one which advances the ack number
 *
 * if this ACKs a rtt estimate
 *	indicate we are not timing
 *	reset the exponential timer backoff (gamma)
 * update rtt estimate
 * cancel retrans timer if everything is sent and ACK'd, else set it
 * advance the ack number if appropriate
 * update segment to send next if appropriate
 */
Process an ACK
this version of the routine doesn't necessarily
require the ack to be one which advances the ack number

if this ACKs a rtt estimate
indicate we are not timing
reset the exponential timer backoff (gamma)
update rtt estimate
cancel retrans timer if everything is sent and ACK'd, else set it
advance the ack number if appropriate
update segment to send next if appropriate
Process an ACK this version of the routine doesn ' t necessarily require the ack to be one which advances the ack number if this ACKs a rtt estimate indicate we are not timing reset the exponential timer backoff ( gamma ) update rtt estimate cancel retrans timer if everything is sent and ACK ' d else set it advance the ack number if appropriate update segment to send next if appropriate
void BayFullTcpAgent::newack(Packet* pkt)
{
    hdr_tcp *tcph = hdr_tcp::access(pkt);
	register int ackno = tcph->ackno();
	if (rtt_active_ && ackno >= rtt_seq_) {
		rtt_active_ = FALSE;	
		t_backoff_ = 1;		
	}
	double tao = now() - tcph->ts();
	rtt_update(tao);
	if (ackno >= maxseq_)
		cancel_rtx_timeout();
	else {
		if (ackno > highest_ack_) {
			set_rtx_timer();
		}
	}
	if (ackno > highest_ack_)
		highest_ack_ = ackno;
	if (t_seqno_ < highest_ack_)
		t_seqno_ = highest_ack_;	
}
void BayFullTcpAgent :: newack ( Packet * pkt ) { hdr_tcp * tcph = hdr_tcp :: access ( pkt ) ; register int ackno = tcph -> ackno ( ) ; if ( rtt_active_ && ackno >= rtt_seq_ ) { rtt_active_ = FALSE ; t_backoff_ = 1 ; } double tao = now ( ) - tcph -> ts ( ) ; rtt_update ( tao ) ; if ( ackno >= maxseq_ ) cancel_rtx_timeout ( ) ; else { if ( ackno > highest_ack_ ) { set_rtx_timer ( ) ; } } if ( ackno > highest_ack_ ) highest_ack_ = ackno ; if ( t_seqno_ < highest_ack_ ) t_seqno_ = highest_ack_ ; }
Process an ACK
      this version of the routine doesn't necessarily
      require the ack to be one which advances the ack number
Process an ACK this version of the routine doesn ' t necessarily require the ack to be one which advances the ack number
// we were timing the segment and we // got an ACK for it /* got a rtt sample */ // no longer timing // stop exp backoff /* always with timestamp option */ // advance the ack number if this is for new data // set up the next packet to send // thing to send next