forked from quic-go/quic-go
enforce that a conn ID is not retired in a packet that uses that conn ID
This commit is contained in:
@@ -67,7 +67,7 @@ func (m *connIDGenerator) SetMaxActiveConnIDs(limit uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *connIDGenerator) Retire(seq uint64) error {
|
||||
func (m *connIDGenerator) Retire(seq uint64, sentWithDestConnID protocol.ConnectionID) error {
|
||||
if seq > m.highestSeq {
|
||||
return qerr.NewError(qerr.ProtocolViolation, fmt.Sprintf("tried to retire connection ID %d. Highest issued: %d", seq, m.highestSeq))
|
||||
}
|
||||
@@ -76,6 +76,9 @@ func (m *connIDGenerator) Retire(seq uint64) error {
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
if connID.Equal(sentWithDestConnID) {
|
||||
return qerr.NewError(qerr.FrameEncodingError, 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)
|
||||
delete(m.activeSrcConnIDs, seq)
|
||||
// Don't issue a replacement for the initial connection ID.
|
||||
|
||||
Reference in New Issue
Block a user