UDT4协议源码分析之数据的发送和接收

协议分析

Data Sending and Receiving 数据发送和接收

Each UDT entity has two logical parts: the sender and the receiver. The sender sends (and retransmits) application data according to the flow control and congestion control. The receiver receives both data packets and control packets, and sends out control packets according to the received packets and the timers. 
每个UDT 实体有两个逻辑部分:sender和receiver。sender根据流量控制和拥塞控制来发送和重传应用层数据。receiver负责接收数据报文和控制报文,并根据接收到的报文和定时器来发送控制报文。

The receiver is responsible for triggering and processing all control events, including congestion control and reliability control, and their related mechanisms. 
receiver主要负责触发和处理所有的控制事件,包括拥塞控制、可靠控制和其它相关机制。

UDT always tries to pack application data into fixed size packets (the maximum packet size negotiated during connection setup), unless there is not enough data to be sent. 
UDT试着将应用层数据打包成 固定大小的报文(报文的最大长度要和连接方进行协商),除非没有足够的数据发送。

We explained the rationale of some of the UDT data sending/receiving schemes in [GHG04b].
我们在[GHG04b]中阐述了UDT数据发送和接收机制的基本原理。
[GHG04b] Yunhong Gu, Xinwei Hong, and Robert L. Grossman, Experiences in Design and Implementation of a High Performance Transport Protocol, SC 2004, Nov 6 - 12, Pittsburgh, PA, USA.

The Sender's Algorithm 

Data Structures and Variables:
数据结构和变量:
1) Sender's Loss List: The sender's loss list is used to store the sequence numbers of the lost packets fed back by the receiver through NAK packets or inserted in a timeout event. The numbers are stored in increasing order.
sender丢失列表:sender丢失列表用于存储丢失数据报文的序列号,这些序列号是receiver端通过NAK包反馈回来,或者是超时事件得到的。这些序列号是以升序的顺序存储的。

Data Sending Algorithm: 
数据发送算法:
1) If the sender's loss list is not empty, retransmit the first packet in the list and remove it from the list. Go to 5).
2) In messaging mode, if the packets has been the loss list for a time more than the application specified TTL (time-to-live), send a message drop request and remove all related packets from the loss list. Go to 1). 
3) Wait until there is application data to be sent. 
4) a. If the number of unacknowledged packets exceeds the flow/congestion window size, wait until an ACK comes. Go to 1). 
     b. Pack a new data packet and send it out. 
5) If the sequence number of the current packet is 16n, where n is an integer, go to 2). 
6) Wait (SND - t) time, where SND is the inter-packet interval updated by congestion control and t is the total time used by step 1 to step 5. Go to 1).

1)如果sender丢失列表不为空,重传丢失列表中的第一个数据包并将其从丢失列表中删除。跳转到5)。

2)在message mode中,如果数据包在丢失列表中的时间超过了应用层设置的TTL,则发送一个message drop请求并将相关的报文移除丢失列表。跳转到1)。
3)等待直到应用层有数据发送。
4)a、如果未被确认的数据报文的数量超过了流量/拥塞窗口的大小,则等待直到有ACK到来。跳转到1)。
      b、将一个新的数据包打包并发送出去。
5)如果当前数据报文的序列号是16n,n是整数,则跳转到2)。
6)等待(SND-t)时间,SND代表包的发送间隔,发送间隔是有拥塞控制进行调整的,t代表从步骤1到步骤5的执行时间。跳转到1)

The Receiver's Algorithm 

Data Structures and Variables: 
数据结构和变量:
1) Receiver's Loss List: It is a list of tuples whose values include: the sequence numbers of detected lost data packets, the latest feedback time of each tuple, and a parameter k that is the number of times each one has been fed back in NAK. Values are stored in the increasing order of packet sequence numbers. 
2) ACK History Window: A circular array of each sent ACK andthe time it is sent out. The most recent value will overwrite the oldest one if no more free space in the array. 
3) PKT History Window: A circular array that records the arrival time of each data packet. 
4) Packet Pair Window: A circular array that records the time interval between each probing packet pair. 
5) LRSN: A variable to record the largest received data packet sequence number. LRSN is initialized to the initial sequence number minus 1. 
6) ExpCount: A variable to record number of continuous EXP time-out events. 
1)Receiver丢失列表:它是一个元组列表,它的元素包括:检测到的丢失的数据报文的序列号、每个元组的最近一次反馈时间、每个序列号在NAK中被反馈的次数k。元素根据数据报文序列号的大小升序存储。
2)ACK历史窗口:它是一个循环数组,数组中的值包括了发送的ACK以及ACK发送出去的时间。如果数组空间不够用,则用最新的值覆盖最旧的值。
3)PKT历史窗口:它是一个循环数组,用来记录每个数据包到达的时间。
4)Packet Pair窗口:它是一个循环数组,记录了探测包之间的到达间隔。
5)LRSN:是一个变量,该变量用来记录接收到的最大数据包的序列号。它的初始值为初始序列号-1。
6)ExpCount:一个变量来记录连续发生EXP(time-out)的次数。

Data Receiving Algorithm: 
1) Query the system time to check if ACK, NAK, or EXP timer has expired. If there is any, process the event (as described below in this section) and reset the associated time variables.For ACK, also check the ACK packet interval. 
2) Start time bounded UDP receiving. If no packet arrives, go to 1). 
3) Reset the ExpCount to 1. If there is no unacknowledged data packet, or if this is an ACK or NAK control packet, reset the EXP timer. 
4) Check the flag bit of the packet header. If it is a control packet, process it according to its type and go to 1). 
5) If the sequence number of the current data packet is 16n + 1, where n is an integer, record the time interval between this packet and the last data packet in the Packet Pair Window. 
6) Record the packet arrival time in PKT History Window. 
7) a. If the sequence number of the current data packet is greater than LRSN + 1, put all the sequence numbers between (but excluding) these two values into the receiver's loss list and send them to the sender in an NAK packet. 
     b. If the sequence number is less than LRSN, remove it from the receiver's loss list. 
8) Update LRSN. Go to 1).
数据接收算法:
1)询问系统时间,以便检查ACK、NAK或者EXP定时器是否超时。如果有其中一个超时,则处理以下描述的相关事件,以及重置相关的定时器变量。此外,还要检查ACK包的发送间隔。
2)开始时间是和UDP接收相绑定的。如果没有包到达,则跳转到1.
3)如果没有未被确认的包,或者如果这是一个ACK或NAK控制报文,重置EXP定时器,并将ExpCount设置成为1。
4)检查包头部的flag bit标志位。如果是控制报文,根据它的类型处理它,并跳转到1)
5)如果当前收到数据包的序列号为16n+1,n代表整型,则记录这个数据包和上一个数据包的时间间隔。
6)讲该间隔存储到PKT历史窗口中。
7)a、如果当前数据包的序列号大于LRSN+1,则将LRSN+1和当前收到的数据包的序列号之间的序列号放入到接收端丢失列表中,并通过NAK报文发送给发送端。
      b、如果当前数据包的序列号小于LRSN,将其从接收端丢失列表中移除。
8)更新LRSN,跳转到1。

ACK Event Processing: 
1) Find the sequence number prior to which all the packets have been received by the receiver (ACK number) according to the following rule: if the receiver's loss list is empty, the ACK number is LRSN + 1; otherwise it is the smallest sequence number in the receiver's loss list. 
2) If (a) the ACK number equals to the largest ACK number ever acknowledged by ACK2, or (b) it is equal to the ACK number in the last ACK and the time interval between this two ACK packets is less than 2 RTTs, stop (do not send this ACK). 
3) Assign this ACK a unique increasing ACK sequence number. Pack the ACK packet with RTT, RTT Variance, and flow window size (available receiver buffer size). If this ACK is not triggered by ACK timers, send out this ACK and stop. 
4) Calculate the packet arrival speed according to the following algorithm: Calculate the median value of the last 16 packet arrival intervals (AI) using the values stored in PKT
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值