亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tcp-fast.c

?? fast_tcp的源代碼加上了自己對它的中文注釋
?? C
?? 第 1 頁 / 共 3 頁
字號:
#endif
	return (double)inst_cwnd;
}

/******************************************************************************/
/* parameter estimation */
void
FastTcpAgent::fast_est(Packet *pkt,double rtt)
{
	hdr_tcp *tcph = hdr_tcp::access(pkt);
	
	if(rtt < baseRTT_)
		baseRTT_ = rtt;			//始終保存最小的RTT為baseRTT_
	avg_cwnd_last_RTT_ = (fast_est_update_avg_cwnd(t_seqno_ - tcph->seqno() - dupacks_));//在該版本中fast_est_update_avg_cwnd函數始終都只返回參數值,即返回t_seqno_ - tcph->seqno() - dupacks_
	avgRTT_ = fast_est_update_avgrtt(rtt);//更新平均RTT值
}

/******************************************************************************/
/* congestion control */
void
FastTcpAgent::fast_cc(double rtt, double old_cwnd)
{
	// We update acks_last_rtt every RTT.	//記錄最近一個RTT時間內收到的確認數保存在acks_last_rtt中
	if ( fast_calc_cwnd_end + rtt < currentTime )
	{
		fast_calc_cwnd_end = currentTime;
		acks_last_rtt = acks_per_rtt;	//保存最近一個RTT時間的確認數
		acks_per_rtt = 0;		//重新清零
		if ( on_first_rtt_ == true )	//反轉on_first_rtt,當定義UPDATE_CWND_EVERY_OTHER_RTT時用于標識兩次fast_update_cwnd_interval_時間間隔才更新一次窗口值
			on_first_rtt_ = false;
		else
			on_first_rtt_ = true;
	}
	acks_per_rtt++;			//累加該RTT內收到的確認數
	
	// We use MI to increase cwnd_ when there is little queueing delay
	if ( avgRTT_ - baseRTT_ < mi_threshold_ && (fast_opts & FAST_ALLOW_MI) )//有小部分的包排隊延時時,使用加數增大窗口,防止窗口增大過快
	{
		cwnd_++;
		cwnd_update_time = currentTime;
		return;
	}
	
	// If queueing delay is large, we use fast algorithm
	if ( currentTime >= cwnd_update_time + fast_update_cwnd_interval_	//間隔fast_update_cwnd_interval_才計算一次新窗口大小
#ifdef	UPDATE_CWND_EVERY_OTHER_RTT
		&& on_first_rtt_ == true
#endif
	)
	{
		double updated_cwnd;
		cwnd_increments = 0;		//在fast_pace()中用于計算窗口步進值
		updated_cwnd = fast_calc_cwnd(cwnd_,old_cwnd);			//計算新窗口大小
		if ( updated_cwnd >= cwnd_ && baseRTT_ >= 0.004 && baseRTT_ != DOUBLE_VARABLE_INVALID_VALUE )//帶寬不高且要增大窗口
		{
			fast_pace(&cwnd_, (int)(updated_cwnd-cwnd_));
		}
		else
			cwnd_ = updated_cwnd;
		cwnd_update_time = currentTime;
	}
	else if ( baseRTT_ >= 0.004 && baseRTT_ != DOUBLE_VARABLE_INVALID_VALUE )
		fast_pace(&cwnd_, 0);
}

#define MIN(x, y) ((x)<(y) ? (x) : (y))
/******************************************************************************/
void
FastTcpAgent::recv(Packet *pkt, Handler *)
{
	currentTime = fasttime();
	hdr_tcp *tcph = hdr_tcp::access(pkt);		//pkt偏移得到tcp頭
	hdr_flags *flagh = hdr_flags::access(pkt);
	int valid_ack = 0;
	
	if (qs_approved_ == 1 && tcph->seqno() > last_ack_)
		endQuickStart();
	if (qs_requested_ == 1)
		processQuickStart(pkt);
	
	/* W.N.: check if this is from a previous incarnation */
	if (tcph->ts() < lastreset_)		//tcp->ts()返回該包的產生時間,因為對方重傳包時.包產生時間不變.所以可以用來確定該包是否為重傳的包
	{
		// Remove packet and do nothing
		Packet::free(pkt);
		return;
	}
	++nackpack_;
	if(firstrecv_<0)	//初始化時設為-0.1
	{ // init fast rtt vars
		firstrecv_ = currentTime;	//currentTime 是以firstsent_做為基準值開始計時的
		baseRTT_ = avgRTT_ = rtt_ = firstrecv_;		//接收到的第一個包的時間
	}
	
	if (flagh->ecnecho())
		ecn(tcph->seqno());
	
	int ecnecho = hdr_flags::access(pkt)->ecnecho();
	if (ecnecho && ecn_)
		ecn(tcph->seqno());
	// Check if ACK is valid.  Suggestion by Mark Allman.
	if (tcph->seqno() >= last_ack_)		//包的序號比之前已經確認收到的序號大.即有效包	
		valid_ack = 1;
	
#ifdef FASTTCPAGENT_DEBUG
	if (cwnd_ <= 0)
		printf("%8.3f : cwnd is not positive! cwnd is %f .\n", (double)currentTime, (double)cwnd_);
#endif
		/*
		* If DSACK is being used, check for DSACK blocks here.
		* Possibilities:  Check for unnecessary Fast Retransmits.
	*/
	if (!fastrecov_)
	{//未啟用快恢復(快重傳)
		/* normal... not fast recovery */
		if ((int)tcph->seqno() > last_ack_)	//收到比要確認包值更大的包,即提前收到了要接收的下一個包后面的包.也說明了要收的last_ack_未到達
		{
			if (last_ack_ == 0 )		//是第一個包
			{
				cwnd_ = initial_window();	//初始化窗口值
			}
			
			/* check if cwnd has been inflated */
#if 1
			if(dupacks_ > numdupacks_ &&  cwnd_ > newcwnd_)
			{
				//check t_seqno_ before changing cwnd.
				if (t_seqno_ < tcph->seqno())		
					t_seqno_ = tcph->seqno();
				//cwnd becomes a negative number in some case.
				
				cwnd_ = t_seqno_ - tcph->seqno() + 1;		//確保cwnd_最小為1
				dupacks_ = 0;
				for (int i=0;i<maxwnd_;i++)
					cwnd_array_[i]=cwnd_;
			}
#endif
			
			firstpartial_ = 0;
			
			// reset sendtime for acked pkts and incr transmits_
			double sendTime = sendtime_[tcph->seqno()%maxwnd_];
			double old_pif=cwnd_array_[tcph->seqno()%maxwnd_];
			int transmits = transmits_[tcph->seqno()% maxwnd_];
			for(int k= (last_natural_ack_number_+1); k<=tcph->seqno(); ++k)//last_natural_ack_number_+1到tcph->seqno()之間的包未到達
			{
				sendtime_[k%maxwnd_] = -1.0;
				transmits_[k%maxwnd_] = 0;
				cwnd_array_[k%maxwnd_]=-1;
			}
			if (t_seqno_ > tcph->seqno())
			{
				if ((transmits == 1) && (currentTime - sendTime > 0))
					rtt_ = currentTime - sendTime;
				else
					rtt_ = avgRTT_;
			}else
				rtt_ = avgRTT_;			//出現重傳時不影響平均RTT的計算
			
			fast_recv_newack_helper(pkt);
			timeout_ = FALSE;
			scb_->ClearScoreBoard();
			fast_est(pkt, rtt_);
			fast_cc(rtt_, old_pif);			//擁塞控制
			last_natural_ack_number_ = tcph->seqno();	//最近收到的包序號;
		} else if ((int)tcph->seqno() < last_ack_)		//重復的包,即該已經確認收到了
		{
			/*NOTHING*/
			//the follows are if (int)tcph->seqno() == last_ack_
		} else if (timeout_ == FALSE)
		{
			if (tcph->seqno() != last_ack_)
			{
				fprintf(stderr, "pkt seq %d should be %d\n", tcph->seqno(), last_ack_);
				abort();
			}
			scb_->UpdateScoreBoard (highest_ack_, tcph);
			/*
			* Check for a duplicate ACK.
			* Check that the SACK block actually
			*  acknowledges new data.
			*/
			if(scb_->CheckUpdate())
			{
				if (++dupacks_ == numdupacks(cwnd_))
				{
				/*
				* Assume we dropped just one packet.
				* Retransmit last ack + 1
				* and try to resume the sequence.
					*/
					dupack_action();		//確認次數超過一定值.重傳該包
				} else if (dupacks_ < numdupacks(cwnd_) && singledup_ )
				{
					send_one();		//發送新包
				}
			}
		}
		if (valid_ack || aggressive_maxburst_)
			if (dupacks_ == 0)
				send_much(FALSE, 0, maxburst_);		//將窗口中的包發完
	} else
	{//啟用快恢復(快重傳)
		/* we are in fast recovery */
		cwnd_update_time = currentTime;
		--pipe_;
		if ((int)tcph->seqno() >= recover_)
		{
			/* ACK indicates fast recovery is over */
			recover_ = 0;
			fastrecov_ = FALSE;
			newack(pkt);		//新的未確認的包到達
			/* if the connection is done, call finish() */
			if ((highest_ack_ >= curseq_-1) && !closed_)
			{
				closed_ = 1;
				finish();
			}
			timeout_ = FALSE;
			scb_->ClearScoreBoard();
			
			/* New window: W/2 - K or W/2? */
		} else if ((int)tcph->seqno() > highest_ack_)
		{
		/* Not out of fast recovery yet.
			* Update highest_ack_, but not last_ack_. */
			highest_ack_ = (int)tcph->seqno();	//更新確認序號,即收到的最大序號
			scb_->UpdateScoreBoard (highest_ack_, tcph);
			if (partial_ack_)
			{
				/* partial_ack_ is needed to guarantee that */
				/*  a new packet is sent in response to a   */
				/*  partial ack.                            */
				partial_ack_action();
				++pipe_;
				if (firstpartial_ == 0)
				{
					newtimer(pkt);
					t_backoff_ = 1;
					firstpartial_ = 1;
				}
			} else
			{
				--pipe_;
				newtimer(pkt);
				t_backoff_ = 1;
				/* If this partial ACK is from a retransmitted pkt,*/
				/* then we decrement pipe_ again, so that we never */
				/* do worse than slow-start.  If this partial ACK  */
				/* was instead from the original packet, reordered,*/
				/* then this might be too aggressive. */
			}
		} else if (timeout_ == FALSE)
		{
			/* got another dup ack */
			scb_->UpdateScoreBoard (highest_ack_, tcph);
			if(scb_->CheckUpdate())
			{
				if (dupacks_ > 0)
					dupacks_++;
			}
		}
		if (valid_ack || aggressive_maxburst_)
			send_much(FALSE, 0, maxburst_);
	}
	Packet::free(pkt);
}
	
/******************************************************************************/
void
FastTcpAgent::dupack_action()
{
	int recovered = (highest_ack_ > recover_);
	if (recovered || (!bug_fix_ && !ecn_))
	{
		goto sack_action;
	}
	
	if (ecn_ && last_cwnd_action_ == CWND_ACTION_ECN)
	{
		last_cwnd_action_ = CWND_ACTION_DUPACK;
		/*
		* What if there is a DUPACK action followed closely by ECN
		* followed closely by a DUPACK action?
		* The optimal thing to do would be to remember all
		* congestion actions from the most recent window
		* of data.  Otherwise "bugfix" might not prevent
		* all unnecessary Fast Retransmits.
		*/
		reset_rtx_timer(1,0);
		/*
		* There are three possibilities:
		* (1) pipe_ = int(cwnd_) - numdupacks_;
		* (2) pipe_ = window() - numdupacks_;
		* (3) pipe_ = maxseq_ - highest_ack_ - numdupacks_;
		* equation (2) takes into account the receiver's
		* advertised window, and equation (3) takes into
		* account a data-limited sender.
		*/
		if (singledup_ && LimTransmitFix_)
		{
			pipe_ = maxseq_ - highest_ack_ - 1;
		}
		else
		{
			// numdupacks(cwnd_) packets have left the pipe
			pipe_ = maxseq_ - highest_ack_ - numdupacks(cwnd_);
		}
		fastrecov_ = TRUE;		//啟動快重傳
		scb_->MarkRetran(highest_ack_+1);
		output(last_ack_ + 1, TCP_REASON_DUPACK);
		return;
	}
	
	if (bug_fix_)
	{
	/*
	* The line below, for "bug_fix_" true, avoids
	* problems with multiple fast retransmits in one
	* window of data.
		*/
		return;
	}
	
sack_action:
	// we are now going into fast_recovery and will trace that event
	trace_event("FAST_RECOVERY");
	
	recover_ = maxseq_;
	last_cwnd_action_ = CWND_ACTION_DUPACK;
	if (oldCode_)
	{
		pipe_ = int(cwnd_) - numdupacks(cwnd_);
	} else if (singledup_ && LimTransmitFix_)
	{
		pipe_ = maxseq_ - highest_ack_ - 1;
	}
	else
	{
		// numdupacks(cwnd_) packets have left the pipe
		pipe_ = maxseq_ - highest_ack_ - numdupacks(cwnd_);
	}
	slowdown(CLOSE_SSTHRESH_HALF|CLOSE_CWND_HALF);
	reset_rtx_timer(1,0);
	fastrecov_ = TRUE;
	scb_->MarkRetran(highest_ack_+1);
	output(last_ack_ + 1, TCP_REASON_DUPACK);	// from top
												/*
												* If dynamically adjusting numdupacks_, record information
												*  at this point.
	*/
	return;
}

/*
* Process a packet that acks previously unacknowledges data, but
* does not take us out of Fast Retransmit.
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩免费高清电影| 视频一区视频二区在线观看| 亚洲自拍都市欧美小说| 国产一区二区三区免费看| 色乱码一区二区三区88| 久久精品一区二区三区不卡| 天堂一区二区在线| 97精品视频在线观看自产线路二| 日韩女同互慰一区二区| 亚洲精品乱码久久久久| av电影在线观看完整版一区二区| 精品国产伦一区二区三区免费| 亚洲一区在线看| 色综合久久久久综合99| 国产精品理论在线观看| 粉嫩一区二区三区在线看| 欧美电影免费观看高清完整版在线| 性做久久久久久免费观看欧美| 91一区二区在线| 国产精品成人免费在线| 国产91在线|亚洲| www国产精品av| 久久99国产精品久久99果冻传媒| 欧美日韩精品电影| 午夜精品久久久久久久蜜桃app| 91视频免费播放| 亚洲欧洲色图综合| 成人午夜免费视频| 国产精品电影一区二区| av中文字幕一区| 中文成人av在线| www.在线欧美| 成人免费在线观看入口| 99热在这里有精品免费| 亚洲蜜臀av乱码久久精品| 91美女视频网站| 亚洲国产精品麻豆| 91精品国产色综合久久不卡电影 | 久久久久一区二区三区四区| 麻豆91免费看| 久久亚洲综合av| 国产v综合v亚洲欧| 亚洲欧美日韩国产综合| 色又黄又爽网站www久久| 亚洲一区二区三区爽爽爽爽爽| 欧美亚洲一区二区在线观看| 午夜精品福利一区二区蜜股av| 欧美日本在线观看| 精品亚洲成av人在线观看| 久久精品水蜜桃av综合天堂| fc2成人免费人成在线观看播放| 亚洲婷婷在线视频| 欧美亚男人的天堂| 美女一区二区三区| 亚洲国产经典视频| 欧美在线免费播放| 精品一区二区三区久久| 中文字幕一区免费在线观看| 91豆麻精品91久久久久久| 日本大胆欧美人术艺术动态| 精品国产91亚洲一区二区三区婷婷| 成人一区二区三区中文字幕| 亚洲激情中文1区| 欧美va亚洲va香蕉在线| 成人黄页在线观看| 天天综合色天天综合| 久久九九影视网| 欧美优质美女网站| 国产白丝精品91爽爽久久 | 在线观看视频一区二区欧美日韩| 日日骚欧美日韩| 国产精品日韩成人| 欧美肥胖老妇做爰| 9久草视频在线视频精品| 视频在线在亚洲| 欧美激情一二三区| 日韩一区二区三区在线视频| www.亚洲在线| 青青青爽久久午夜综合久久午夜| 国产精品国产三级国产aⅴ无密码| 91精品国产综合久久久蜜臀图片| 成人午夜精品在线| 九色综合狠狠综合久久| 亚洲国产aⅴ成人精品无吗| 欧美激情中文字幕一区二区| 日韩欧美你懂的| 欧美日韩日本视频| 99国产欧美久久久精品| 国产一区二区三区在线观看精品 | 国产精品乱码妇女bbbb| 欧美tickling挠脚心丨vk| 欧美三级电影网| 色呦呦一区二区三区| 成人国产精品免费| 国产经典欧美精品| 激情欧美一区二区| 另类中文字幕网| 日韩国产在线一| 亚洲va韩国va欧美va| 一区二区视频免费在线观看| 国产精品麻豆欧美日韩ww| 久久久久综合网| 久久久久9999亚洲精品| 精品国内二区三区| 日韩午夜精品视频| 精品久久人人做人人爰| 欧美一级高清大全免费观看| 欧美日韩亚洲不卡| 欧美日韩国产中文| 91精品国产一区二区三区香蕉| 欧美日韩精品系列| 91精品国产综合久久婷婷香蕉 | 日韩精品视频网站| 日韩黄色片在线观看| 日韩av一二三| 精品亚洲国产成人av制服丝袜| 久久99国产精品麻豆| 狠狠色狠狠色综合日日91app| 精品一区二区三区在线播放| 国产美女在线精品| 福利一区二区在线观看| 99久久精品免费看国产免费软件| av综合在线播放| 在线欧美小视频| 538在线一区二区精品国产| 日韩情涩欧美日韩视频| 精品国产区一区| 国产精品久久久久久久午夜片| 国产精品久久夜| 亚洲一区视频在线| 日本色综合中文字幕| 九九视频精品免费| 不卡的看片网站| 欧美三级三级三级| 337p日本欧洲亚洲大胆色噜噜| 国产欧美视频在线观看| 亚洲激情中文1区| 婷婷中文字幕一区三区| 精品一区二区综合| 成人黄色一级视频| 欧美日韩亚洲不卡| 国产欧美一区二区精品性| 国产精品无人区| 亚洲最大成人综合| 激情偷乱视频一区二区三区| 99精品视频免费在线观看| 欧美日韩成人综合| 国产夜色精品一区二区av| 一区二区三区日韩欧美| 男女视频一区二区| 成人黄色小视频在线观看| 欧美女孩性生活视频| 日本一区二区三级电影在线观看 | 极品销魂美女一区二区三区| 高清不卡在线观看av| 欧美视频中文一区二区三区在线观看| 日韩午夜av一区| 亚洲综合激情另类小说区| 国产一区二区不卡在线| 欧美色欧美亚洲另类二区| 久久久99精品久久| 午夜天堂影视香蕉久久| av资源站一区| 久久久久久影视| 蜜臀av一级做a爰片久久| 91免费在线播放| 国产亚洲婷婷免费| 日本在线不卡视频| 色999日韩国产欧美一区二区| www久久久久| 美国三级日本三级久久99| 91丨九色丨国产丨porny| 久久在线观看免费| 日韩经典一区二区| 在线视频一区二区免费| 中文字幕av不卡| 国产一区二区三区最好精华液| 欧美日韩国产a| 亚洲欧美激情在线| 99久久精品久久久久久清纯| 国产喂奶挤奶一区二区三区| 国产日韩精品久久久| 久久精品国产99| 国产一区二区三区免费| 7777精品伊人久久久大香线蕉超级流畅 | 91福利在线观看| 中文字幕精品三区| 国产精品综合一区二区| 日韩精品一区二区三区在线播放| 亚洲超碰精品一区二区| 91官网在线观看| 亚洲乱码中文字幕综合| 色综合久久88色综合天天免费| 国产精品每日更新在线播放网址| 国产一区福利在线| 久久综合久久综合亚洲| 国产专区综合网| 久久久99精品久久| 国产成a人亚洲精品| 国产精品丝袜久久久久久app|