Http2Session 和套接字


🌐 Http2Session and sockets

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

🌐 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.

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

🌐 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.

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

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