mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
delete unused connections from the multiplexer
This commit is contained in:
parent
6fbe8d563e
commit
1a0aa50471
4 changed files with 37 additions and 1 deletions
|
@ -45,6 +45,16 @@ var _ = Describe("Packet Handler Map", func() {
|
|||
})
|
||||
|
||||
It("closes", func() {
|
||||
getMultiplexer() // make the sync.Once execute
|
||||
// replace the clientMuxer. getClientMultiplexer will now return the MockMultiplexer
|
||||
mockMultiplexer := NewMockMultiplexer(mockCtrl)
|
||||
origMultiplexer := connMuxer
|
||||
connMuxer = mockMultiplexer
|
||||
|
||||
defer func() {
|
||||
connMuxer = origMultiplexer
|
||||
}()
|
||||
|
||||
testErr := errors.New("test error ")
|
||||
sess1 := NewMockPacketHandler(mockCtrl)
|
||||
sess1.EXPECT().destroy(testErr)
|
||||
|
@ -52,6 +62,7 @@ var _ = Describe("Packet Handler Map", func() {
|
|||
sess2.EXPECT().destroy(testErr)
|
||||
handler.Add(protocol.ConnectionID{1, 1, 1, 1}, sess1)
|
||||
handler.Add(protocol.ConnectionID{2, 2, 2, 2}, sess2)
|
||||
mockMultiplexer.EXPECT().RemoveConn(gomock.Any())
|
||||
handler.close(testErr)
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue