implement replacing with a closed session for all active connection IDs

This commit is contained in:
Marten Seemann 2019-11-03 10:05:23 +07:00
parent f948165824
commit 5d0d0d0679
2 changed files with 35 additions and 9 deletions

View file

@ -18,6 +18,7 @@ type connIDGenerator struct {
addConnectionID func(protocol.ConnectionID) [16]byte
removeConnectionID func(protocol.ConnectionID)
retireConnectionID func(protocol.ConnectionID)
replaceWithClosed func(protocol.ConnectionID, packetHandler)
queueControlFrame func(wire.Frame)
}
@ -26,6 +27,7 @@ func newConnIDGenerator(
addConnectionID func(protocol.ConnectionID) [16]byte,
removeConnectionID func(protocol.ConnectionID),
retireConnectionID func(protocol.ConnectionID),
replaceWithClosed func(protocol.ConnectionID, packetHandler),
queueControlFrame func(wire.Frame),
) *connIDGenerator {
m := &connIDGenerator{
@ -34,6 +36,7 @@ func newConnIDGenerator(
addConnectionID: addConnectionID,
removeConnectionID: removeConnectionID,
retireConnectionID: retireConnectionID,
replaceWithClosed: replaceWithClosed,
queueControlFrame: queueControlFrame,
}
m.activeSrcConnIDs[0] = initialConnectionID
@ -93,3 +96,9 @@ func (m *connIDGenerator) RemoveAll() {
m.removeConnectionID(connID)
}
}
func (m *connIDGenerator) ReplaceWithClosed(handler packetHandler) {
for _, connID := range m.activeSrcConnIDs {
m.replaceWithClosed(connID, handler)
}
}