add a flag to disable conn ID generation and the check for retired conn IDs

This commit is contained in:
Marten Seemann 2020-07-08 17:31:15 +07:00
parent 953f3472cf
commit ce5ddc050c
3 changed files with 35 additions and 1 deletions

View file

@ -76,7 +76,7 @@ func (m *connIDGenerator) Retire(seq uint64, sentWithDestConnID protocol.Connect
if !ok {
return nil
}
if connID.Equal(sentWithDestConnID) {
if connID.Equal(sentWithDestConnID) && !RetireBugBackwardsCompatibilityMode {
return qerr.NewError(qerr.ProtocolViolation, fmt.Sprintf("tried to retire connection ID %d (%s), which was used as the Destination Connection ID on this packet", seq, connID))
}
m.retireConnectionID(connID)
@ -89,6 +89,9 @@ func (m *connIDGenerator) Retire(seq uint64, sentWithDestConnID protocol.Connect
}
func (m *connIDGenerator) issueNewConnID() error {
if RetireBugBackwardsCompatibilityMode {
return nil
}
connID, err := protocol.GenerateConnectionID(m.connIDLen)
if err != nil {
return err