Skip to content

Commit 11b5a84

Browse files
committed
Stop timer if device roams away from node
1 parent f722ba4 commit 11b5a84

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/router/firewall.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ func (f *Firewall) UpdateNodeAssociation(device data.Device) error {
246246
// TODO figure out a better way of doing this
247247
// when a client shifts over to us, make sure we set the last packet time to something they can actually use
248248
d.SetActive(f.db, f.inactivityTimeout)
249+
} else {
250+
// its roamed away from us
251+
if d.inactiveTimer != nil {
252+
d.inactiveTimer.Stop()
253+
d.inactiveTimer = nil
254+
}
249255
}
250256

251257
d.associatedNode = device.AssociatedNode
@@ -610,6 +616,10 @@ func (fwd *FirewallDevice) SetActive(db interfaces.Database, duration time.Durat
610616
fwd.inactive = false
611617

612618
if duration == -1 {
619+
if fwd.inactiveTimer != nil {
620+
fwd.inactiveTimer.Stop()
621+
fwd.inactiveTimer = nil
622+
}
613623
// if the inactivity duration is -1 that means its disabled, thus dont start a timer or reset a timer
614624
return
615625
}

0 commit comments

Comments
 (0)