1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
70
71
72
73
74
75
76
// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
//
// This file is part of Zond Engine, licensed under the GNU Affero General
// Public License, version 3 or later. See the LICENSE file for details, or
// <https://www.gnu.org/licenses/agpl-3.0.html>.
//
// SPDX-License-Identifier: AGPL-3.0-or-later
//! # Stopping a scan
//!
//! One flag and two methods. A scan spawns strategies that outlive the call
//! that started them, so something has to reach across into all of them at
//! once, and that something has to be cheap enough to read on every pass of
//! every probing loop.
//!
//! [`ScanHandle`] is that flag. Everything else about stopping a scan follows
//! from what it deliberately is not: it does not cancel tasks, it does not
//! discard findings, and it cannot be undone. The type's own documentation has
//! the argument for each.
use Arc;
use ;
/// The means to stop a running scan.
///
/// One flag, shared by every strategy a scan spawned. Each of them checks it on
/// every pass of its own loop rather than only between targets, so a scan of a
/// large range stops promptly instead of after the address it is on.
///
/// **Stopping is not cancelling.** The scan winds down and still produces its
/// [`ScanReport`](crate::scanner::report::ScanReport), describing however far it
/// got — the hosts already found are findings, and discarding them because the
/// caller ran out of patience would throw away the work the scan had done. The
/// report's [`StopReason`](crate::scanner::report::StopReason) says
/// `Aborted` so nobody mistakes a shortened scan for a complete one.
///
/// Cloneable and shareable: the copy on a [`ScanSession`](crate::scanner::session::ScanSession)
/// and the copies held by the strategies are the same flag.