v0.13.0
v0.13.0 introduces a BREAKING interface change: MuxedConn.OpenStream
and Conn.NewStream
now both take a context.Context
. This allows stream multiplexer implementations to unblock OpenStream
when requested to do so.
Many stream multiplexers implement some kind of limit on how many streams can be opened at any given moment. This is a useful DoS protection against a peer that would open an unlimited number of streams. That means that opening a new stream might block if it's not possible to open a new stream at that moment.
Upgrade Path
Although breaking, this change is expected to cause little breakage in practice: Host.NewStream
already takes a context.Context
, which is now passed down to the stream multiplexer's OpenStream
method. Only when using Conn.NewStream
it will be necessary to add a context to that call.