QUIC的Stream

QUIC的流介绍

Streams in QUIC provide a lightweight, ordered byte-stream abstraction to an application. Streams can be unidirectional or bidirectional.
QUIC allows for an arbitrary number of streams to operate concurrently and for an arbitrary amount of data to be sent on any stream, subject to flow control constraints and stream limits
QUIC允许任意数量的流同时运行,允许在任意流上发送任意数量的数据,但是受流控约束

QUIC流的标识和类型

Streams are identified within a connection by a numeric value, referred to as the stream ID.
A stream ID is a 62-bit integer (0 to 262-1) that is unique for all streams on a connection.
A QUIC endpoint MUST NOT reuse a stream ID within a connection.
同一个conn上,不同的stream有不同的ID

QUIC流的类型分为单向和双向(根据Stream ID的最后两位进行区分),任何一端都可以创建流,可以并发发送与其他流交错的数据
同一个流,ordered byte-stream;不同的流的字节数据的排序,未规定。
在这里插入图片描述
The stream space for each type begins at the minimum value (0x00 through 0x03, respectively); successive streams of each type are created with numerically increasing stream IDs.
数字递增的流ID创建

注意:
A stream ID that is used out of order results in all streams of that type with lower-numbered stream IDs also being opened.
这是使用stream ID的姿势

数据的收发

有序发送(AP->EP)

STREAM 帧: STREAM frames encapsulate data sent by an application.
An endpoint uses the Stream ID and Offset fields in STREAM frames to place data in order.

有序接收(EP->AP)

Endpoints MUST be able to deliver stream data to an application as an ordered byte stream.
Delivering an ordered byte stream requires that an endpoint buffer any data that is received out of order, up to the advertised flow control limit.
端点需要能缓冲任何无序收到的数据,直到达到流控阈值

无序接收(EP->AP)

QUIC makes no specific allowances for delivery of stream data out of order.
However, implementations MAY choose to offer the ability to deliver data out of order to a receiving application.
无序接收给到应用程序后,哪些场景会用到这种无序数据呢?(游戏的实时帧?)

发送侧AP侧动作

  • write data, understanding when stream flow control credit has successfully been reserved to send the written data
  • end the stream (clean termination), resulting in a STREAM frame with the FIN bit set
  • reset the stream (abrupt termination), resulting in a RESET_STREAM frame if the stream was not already in a terminal state

接收侧AP侧动作

  • read data
  • abort reading of the stream and request closure, possibly resulting in a STOP_SENDING frame

个人理解

收发侧,丝滑的抽象

QUIC流的状态机

QUIC流的状态机也被设计成两种

  • 发送状态机
  • 接收状态机

Two state machines are described: one for the streams on which an endpoint transmits data and another for streams on which an endpoint receives data
(TCP上貌似状态机是一套,耦合很深)

单双向状态机介绍

Unidirectional streams use either the sending or receiving state machine, depending on the stream type and endpoint role.
Bidirectional streams use both state machines at both endpoints.

For the mos

  • 14
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值