dope_sys/io/socket/accept.rs
1use std::num;
2
3use crate::{Cloexec, Errno, io::socket::Setup, table::registry};
4
5/// Native accept failures retain the host's readiness-only terminal cases.
6pub trait Source {
7 type Failure<F: From<Errno>>: From<Errno> + Into<F>;
8
9 /// Maximum simultaneous native accept operations on one listener.
10 const MAX_IN_FLIGHT: num::NonZero<usize>;
11
12 /// Whether one native accept failure permits another attempt on the listener.
13 /// Resource exhaustion never permits an unconditional retry; retain its exact error.
14 fn is_retryable(error: Errno) -> bool;
15
16 /// Whether actual descriptor retirement permits one later attempt after this error.
17 /// This does not establish a pending retirement or identify the error's origin.
18 fn can_defer(error: Errno) -> bool;
19}
20
21#[derive(Debug)]
22pub enum Error {
23 Syscall(Errno),
24 Registration(registry::Failure),
25 Cloexec(Cloexec),
26 Setup(Setup),
27 Capacity { close: Result<(), Errno> },
28}