Commit c231d4d
committed
banman: schedule sweep at ban expiry instead of polling
Give BanMan access to CScheduler so it can fire SweepBanned()
at the exact moment the next ban expires. This triggers
BannedListChanged to refresh the GUI without polling timers.
Track m_next_sweep_time to avoid accumulating redundant scheduled
tasks: Ban() only reschedules when the new ban expires sooner than
what is already scheduled, and ScheduleNextSweep() skips if a
sweep is already pending for an earlier or equal time.
Fix an off-by-one in SweepBanned(): use >= instead of > so that
entries are swept at the exact expiry second, consistent with
IsBanned() which uses < for the active check. This prevents a
tight reschedule loop when the scheduler fires at the boundary.
Fixes bitcoinknots#2731 parent a9aee73 commit c231d4d
3 files changed
Lines changed: 57 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
29 | 70 | | |
30 | 71 | | |
31 | 72 | | |
| |||
144 | 185 | | |
145 | 186 | | |
146 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
147 | 194 | | |
148 | 195 | | |
149 | 196 | | |
| |||
189 | 236 | | |
190 | 237 | | |
191 | 238 | | |
192 | | - | |
| 239 | + | |
193 | 240 | | |
194 | 241 | | |
195 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
| 90 | + | |
86 | 91 | | |
87 | 92 | | |
| 93 | + | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2437 | 2437 | | |
2438 | 2438 | | |
2439 | 2439 | | |
| 2440 | + | |
| 2441 | + | |
2440 | 2442 | | |
2441 | 2443 | | |
2442 | 2444 | | |
| |||
0 commit comments