forked from quic-go/quic-go
fix memory leak on connection ID rotation when closing connection (#4852)
* fix memory leak on connection ID rotation during CONNECTION_CLOSE In rare instances, the connection ID manager might switch to a new connection ID when sending the packet containing the CONNECTION_CLOSE frame. The connection ID manager removes the active stateless reset token from the packet handler map when it is closed, so we need to make sure that this happens last, otherwise the packet handler will keep a pointer to the closed connection indefinitely. * defer * panic on use of connIDManager after Close
This commit is contained in:
@@ -242,4 +242,7 @@ func TestConnIDManagerClose(t *testing.T) {
|
||||
require.Empty(t, removedTokens)
|
||||
m.Close()
|
||||
require.Equal(t, []protocol.StatelessResetToken{{16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}}, removedTokens)
|
||||
|
||||
require.Panics(t, func() { m.Get() })
|
||||
require.Panics(t, func() { m.SetStatelessResetToken(protocol.StatelessResetToken{}) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user