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
77
78
79
80
81
82
83
84
85
86
87
//! Literal values that encode design and implementation decisions.
use NonZero;
use Duration;
/// Bound so `resume` fails instead of hanging when the supervisor is alive but
/// not accepting.
///
/// Local named-pipe connect is immediate when the supervisor is listening.
/// The duration is an arbitrary watchdog, chosen to sit well above local IPC
/// and well below a human "this is stuck" wait.
/// Ref: docs/design.md, "Attach, detach, steal"; docs/implementation.md,
/// "Accept loop and steal".
pub const CONNECT_TIMEOUT: Duration = from_secs;
/// Bound on how long `terminate` waits for a killed process to become signaled.
///
/// `TerminateProcess` only initiates termination; the process object signals
/// once the kernel has finished tearing it down, which is immediate unless a
/// driver stalls. The duration is an arbitrary watchdog, chosen to sit well
/// above that teardown and well below a human "this is stuck" wait.
pub const TERMINATE_TIMEOUT: Duration = from_secs;
/// Upper bound on one framed transport message.
///
/// Ordinary console bursts are kibibytes. This is an arbitrary sanity cap so a
/// corrupt length prefix cannot force a huge allocation.
pub const MAX_FRAME_LEN: u32 = 1024 * 1024;
/// Largest `Output` payload that fits in one frame.
///
/// A frame's length prefix counts the message kind byte as well as the data, so
/// the data has to stay one byte below the frame cap. It is a chunk size, and a
/// chunk size of zero would divide the payload into infinitely many pieces, so
/// a frame cap too small to carry any payload is a contradiction rather than a
/// value to carry forward.
/// Ref: docs/implementation.md, "Opening output".
pub const MAX_OUTPUT_CHUNK_BYTES: =
match new ;
/// Output bytes the supervisor will hold for a client before giving up on it.
///
/// A client this far behind is not draining its pipe. `dure` keeps no screen
/// buffer, so undelivered output has no later value and the session is better
/// served by dropping the connection than by growing without bound. The size is
/// arbitrary, chosen to sit well above any burst a responsive client causes and
/// well below a memory footprint worth worrying about.
/// Ref: docs/implementation.md, "Transport".
pub const MAX_CLIENT_BACKLOG_BYTES: usize = 4 * 1024 * 1024;
/// Subdirectory under the per-user `LocalAppData` known folder that holds
/// session records.
///
/// Ref: docs/implementation.md, "Session store".
pub const STORE_SUBDIR: &str = "dure";
/// Hidden subcommand that `dure run` uses to spawn the supervisor process.
///
/// Windows has no `exec`; the same binary implements both roles.
/// Ref: docs/implementation.md, "Process split".
pub const SUPERVISOR_COMMAND: &str = "__supervisor";
/// Columns used until the first client attach reports a real size.
///
/// VGA text-mode geometry, the historical Windows console default.
/// Ref: docs/design.md, "Terminal pass-through".
pub const DEFAULT_PTY_COLS: u16 = 80;
/// Rows used until the first client attach reports a real size.
///
/// VGA text-mode geometry, the historical Windows console default.
/// Ref: docs/design.md, "Terminal pass-through".
pub const DEFAULT_PTY_ROWS: u16 = 24;