use an unbuffered chan for the client transport parameters

The client reads the transport parameters from the Encrypted Extensions
message. These transport parameters are passed to the session's run
loop's select statement via a channel.
We have to use an unbuffered channel here to make sure that the session
actually processes the transport parameters immediately.
This commit is contained in:
Marten Seemann
2018-02-08 11:04:27 +08:00
parent d71850eb2f
commit c9b95abe7e
3 changed files with 46 additions and 5 deletions

View File

@@ -31,7 +31,10 @@ func NewExtensionHandlerClient(
supportedVersions []protocol.VersionNumber,
version protocol.VersionNumber,
) TLSExtensionHandler {
paramsChan := make(chan TransportParameters, 1)
// The client reads the transport parameters from the Encrypted Extensions message.
// The paramsChan is used in the session's run loop's select statement.
// We have to use an unbuffered channel here to make sure that the session actually processes the transport parameters immediately.
paramsChan := make(chan TransportParameters)
return &extensionHandlerClient{
ourParams: params,
paramsChan: paramsChan,