Http2Session 与 Socket


每个 Http2Session 实例在创建时都与 net.Sockettls.TLSSocket 关联。 当 SocketHttp2Session 被摧毁时,两者都会被摧毁。

由于 HTTP/2 协议规定的特定序列化和处理要求,不建议用户代码从绑定到 Http2SessionSocket 实例读取数据或向其写入数据。 这样做会使 HTTP/2 会话进入不确定状态,导致会话和套接字变得不可用。

一旦将 Socket 绑定到 Http2Session,用户代码应仅依赖于 Http2Session 的 API。

Every Http2Session instance is associated with exactly one net.Socket or tls.TLSSocket when it is created. When either the Socket or the Http2Session are destroyed, both will be destroyed.

Because of the specific serialization and processing requirements imposed by the HTTP/2 protocol, it is not recommended for user code to read data from or write data to a Socket instance bound to a Http2Session. Doing so can put the HTTP/2 session into an indeterminate state causing the session and the socket to become unusable.

Once a Socket has been bound to an Http2Session, user code should rely solely on the API of the Http2Session.