forked from quic-go/quic-go
remove unneccessary destroy of the session when retiring a connection ID
This commit is contained in:
@@ -72,25 +72,14 @@ func (h *packetHandlerMap) Add(id protocol.ConnectionID, handler packetHandler)
|
||||
|
||||
func (h *packetHandlerMap) Remove(id protocol.ConnectionID) {
|
||||
h.mutex.Lock()
|
||||
h.removeByConnectionIDAsString(string(id))
|
||||
delete(h.handlers, string(id))
|
||||
h.mutex.Unlock()
|
||||
}
|
||||
|
||||
func (h *packetHandlerMap) removeByConnectionIDAsString(id string) {
|
||||
delete(h.handlers, id)
|
||||
}
|
||||
|
||||
func (h *packetHandlerMap) Retire(id protocol.ConnectionID) {
|
||||
h.retireByConnectionIDAsString(string(id))
|
||||
}
|
||||
|
||||
func (h *packetHandlerMap) retireByConnectionIDAsString(id string) {
|
||||
time.AfterFunc(h.deleteRetiredSessionsAfter, func() {
|
||||
h.mutex.Lock()
|
||||
if sess, ok := h.handlers[id]; ok {
|
||||
sess.destroy(errors.New("deleting"))
|
||||
}
|
||||
h.removeByConnectionIDAsString(id)
|
||||
delete(h.handlers, string(id))
|
||||
h.mutex.Unlock()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user