retire stateless reset tokens instead of deleting them immediately

This commit is contained in:
Marten Seemann
2019-10-26 07:02:14 +07:00
parent 772ffd3d20
commit ffbb810fcc
5 changed files with 35 additions and 34 deletions

View File

@@ -134,10 +134,12 @@ func (h *packetHandlerMap) AddResetToken(token [16]byte, handler packetHandler)
h.mutex.Unlock()
}
func (h *packetHandlerMap) RemoveResetToken(token [16]byte) {
h.mutex.Lock()
delete(h.resetTokens, token)
h.mutex.Unlock()
func (h *packetHandlerMap) RetireResetToken(token [16]byte) {
time.AfterFunc(h.deleteRetiredSessionsAfter, func() {
h.mutex.Lock()
delete(h.resetTokens, token)
h.mutex.Unlock()
})
}
func (h *packetHandlerMap) SetServer(s unknownPacketHandler) {