destroy sessions when deleting them from the packet handler map

This commit is contained in:
Marten Seemann
2019-09-24 20:32:53 +07:00
parent 03483d5e71
commit da0288b273
2 changed files with 6 additions and 1 deletions

View File

@@ -86,6 +86,9 @@ func (h *packetHandlerMap) Retire(id protocol.ConnectionID) {
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)
h.mutex.Unlock()
})