Fix dangling goroutine on session expiration
The timer channel may already have been drained by `case <-timer.C`. In this case, we need not to drain it again or we'll block forever. To fix this, stop draining the timer channel. Since we're not going to use the timer again anyway, it should be fine.
This commit is contained in:
parent
8b10324ab6
commit
e6e457e4a7
1 changed files with 1 additions and 3 deletions
|
@ -237,9 +237,7 @@ func (sm *SessionManager) Put(username, password string) (*Session, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !timer.Stop() {
|
timer.Stop()
|
||||||
<-timer.C
|
|
||||||
}
|
|
||||||
|
|
||||||
s.locker.Lock()
|
s.locker.Lock()
|
||||||
if s.imapConn != nil {
|
if s.imapConn != nil {
|
||||||
|
|
Loading…
Reference in a new issue