implement removing of all active connection IDs

This commit is contained in:
Marten Seemann 2019-11-03 08:33:53 +07:00
parent 121795977d
commit f948165824
2 changed files with 25 additions and 0 deletions

View file

@ -16,6 +16,7 @@ type connIDGenerator struct {
activeSrcConnIDs map[uint64]protocol.ConnectionID
addConnectionID func(protocol.ConnectionID) [16]byte
removeConnectionID func(protocol.ConnectionID)
retireConnectionID func(protocol.ConnectionID)
queueControlFrame func(wire.Frame)
}
@ -23,6 +24,7 @@ type connIDGenerator struct {
func newConnIDGenerator(
initialConnectionID protocol.ConnectionID,
addConnectionID func(protocol.ConnectionID) [16]byte,
removeConnectionID func(protocol.ConnectionID),
retireConnectionID func(protocol.ConnectionID),
queueControlFrame func(wire.Frame),
) *connIDGenerator {
@ -30,6 +32,7 @@ func newConnIDGenerator(
connIDLen: initialConnectionID.Len(),
activeSrcConnIDs: make(map[uint64]protocol.ConnectionID),
addConnectionID: addConnectionID,
removeConnectionID: removeConnectionID,
retireConnectionID: retireConnectionID,
queueControlFrame: queueControlFrame,
}
@ -84,3 +87,9 @@ func (m *connIDGenerator) issueNewConnID() error {
m.highestSeq++
return nil
}
func (m *connIDGenerator) RemoveAll() {
for _, connID := range m.activeSrcConnIDs {
m.removeConnectionID(connID)
}
}