forked from quic-go/quic-go
always use connection IDs longer than 8 bytes when sending a Retry
A server is allowed to perform multiple Retries. There's little to gain from doing so, but it's something our API allows. If a server performs multiple Retries, it must use a connection ID that's at least 8 bytes long. Only if it doesn't perform any further Retries it is allowed to use shorter IDs. Therefore, we're on the safe side by always using a long connection ID. This shouldn't have a performance impact, since the server changes the connection ID to a short value with the first Handshake packet it sends.
This commit is contained in:
10
client.go
10
client.go
@@ -57,10 +57,10 @@ var _ packetHandler = &client{}
|
||||
|
||||
var (
|
||||
// make it possible to mock connection ID generation in the tests
|
||||
generateConnectionID = protocol.GenerateConnectionID
|
||||
generateDestConnectionID = protocol.GenerateDestinationConnectionID
|
||||
errCloseSessionForNewVersion = errors.New("closing session in order to recreate it with a new version")
|
||||
errCloseSessionForRetry = errors.New("closing session in response to a stateless retry")
|
||||
generateConnectionID = protocol.GenerateConnectionID
|
||||
generateConnectionIDForInitial = protocol.GenerateConnectionIDForInitial
|
||||
errCloseSessionForNewVersion = errors.New("closing session in order to recreate it with a new version")
|
||||
errCloseSessionForRetry = errors.New("closing session in response to a stateless retry")
|
||||
)
|
||||
|
||||
// DialAddr establishes a new QUIC connection to a server.
|
||||
@@ -259,7 +259,7 @@ func (c *client) generateConnectionIDs() error {
|
||||
}
|
||||
destConnID := srcConnID
|
||||
if c.version.UsesTLS() {
|
||||
destConnID, err = generateDestConnectionID()
|
||||
destConnID, err = generateConnectionIDForInitial()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user