Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e950ce7 commit cb94af0Copy full SHA for cb94af0
device/timers.go
@@ -29,18 +29,17 @@ func (peer *Peer) NewTimer(expirationFunction func(*Peer)) *Timer {
29
timer := &Timer{}
30
timer.Timer = time.AfterFunc(time.Hour, func() {
31
timer.runningLock.Lock()
32
+ defer timer.runningLock.Unlock()
33
34
timer.modifyingLock.Lock()
35
if !timer.isPending {
36
timer.modifyingLock.Unlock()
- timer.runningLock.Unlock()
37
return
38
}
39
timer.isPending = false
40
41
42
expirationFunction(peer)
43
44
})
45
timer.Stop()
46
return timer
0 commit comments