peer->gs's per-second budget: read_hdr_from_peer() and maybe_gossip_msg() * both call this, so whichever notices the window has expired resets it * for both. */
| 625 | * both call this, so whichever notices the window has expired resets it |
| 626 | * for both. */ |
| 627 | static void maybe_reset_usage_window(struct peer *peer) |
| 628 | { |
| 629 | struct timemono now = time_mono(); |
| 630 | |
| 631 | if (time_to_sec(timemono_between(now, peer->gs.window_start)) <= 0) |
| 632 | return; |
| 633 | |
| 634 | peer->gs.window_start = now; |
| 635 | peer->gs.bytes_rcvd_this_second = 0; |
| 636 | peer->gs.bytes_this_second = 0; |
| 637 | peer->gs.cpu_usec_this_second = 0; |
| 638 | } |
| 639 | |
| 640 | /* Each peer gets its "fair share" of our query-answering CPU. No floor: |
| 641 | * that would let enough peers claim more than the whole budget between |
no test coverage detected