freebsd_network: Fix callout_active checking in callout_stop.
We have to perform the "due" check after checking callout_active, because due is set to -1 while the callout is actually active.
This commit is contained in:
@@ -219,9 +219,6 @@ _callout_stop_safe(struct callout *c, int safe)
|
|||||||
|
|
||||||
MutexLocker locker(sLock);
|
MutexLocker locker(sLock);
|
||||||
|
|
||||||
if (c->due <= 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (callout_active(c)) {
|
if (callout_active(c)) {
|
||||||
if (safe) {
|
if (safe) {
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
@@ -231,6 +228,9 @@ _callout_stop_safe(struct callout *c, int safe)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c->due <= 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
// this timer is scheduled, cancel it
|
// this timer is scheduled, cancel it
|
||||||
list_remove_item(&sTimers, c);
|
list_remove_item(&sTimers, c);
|
||||||
c->due = 0;
|
c->due = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user