wait until the handshake is complete before updating the connection ID

This commit is contained in:
Marten Seemann
2020-11-02 16:20:26 +07:00
parent 272229abf0
commit 80534c0944
4 changed files with 31 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ import (
type connIDManager struct {
queue utils.NewConnectionIDList
handshakeComplete bool
activeSequenceNumber uint64
highestRetired uint64
activeConnectionID protocol.ConnectionID
@@ -190,7 +191,10 @@ func (h *connIDManager) SentPacket() {
}
func (h *connIDManager) shouldUpdateConnID() bool {
// initiate the first change as early as possible
if !h.handshakeComplete {
return false
}
// initiate the first change as early as possible (after handshake completion)
if h.queue.Len() > 0 && h.activeSequenceNumber == 0 {
return true
}
@@ -207,3 +211,7 @@ func (h *connIDManager) Get() protocol.ConnectionID {
}
return h.activeConnectionID
}
func (h *connIDManager) SetHandshakeComplete() {
h.handshakeComplete = true
}