Commit 4f5fddc
committed
afpd: reap idle Spotlight queries to prevent resource leaks
Clients that disconnect or crash without sending closeQueryForContext
leave server-side query objects allocated indefinitely. Add a
MAX_SL_QUERY_IDLE_TIME (60 s) constant and slq_idle_cleanup(), which
scans the active query list on every Spotlight RPC and cancels or
destroys any query not polled within the idle window.
The idle timer (slq_time) is reset on each fetchQueryResultsForContext
call so actively-polled queries are not reaped. The cleanup runs
alongside the existing slq_cancelled_cleanup() in afp_spotlight_rpc().1 parent b5a7471 commit 4f5fddc
2 files changed
Lines changed: 60 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
599 | 600 | | |
600 | 601 | | |
601 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
602 | 657 | | |
603 | 658 | | |
604 | 659 | | |
| |||
1016 | 1071 | | |
1017 | 1072 | | |
1018 | 1073 | | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1019 | 1077 | | |
1020 | 1078 | | |
1021 | 1079 | | |
| |||
1412 | 1470 | | |
1413 | 1471 | | |
1414 | 1472 | | |
| 1473 | + | |
1415 | 1474 | | |
1416 | 1475 | | |
1417 | 1476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
0 commit comments