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
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 ZeroDDS Contributors
//! In-process discovery fastpath.
//!
//! Two `DomainParticipant`s in the same process and the same domain
//! discover each other through this process registry **deterministically
//! and synchronously** — instead of relying on lossy UDP multicast
//! SPDP/SEDP, whose reliable retransmit can stall under scheduler load
//! (discovery flake `volatile_writer_does_not_deliver_history_…`).
//!
//! The wire discovery path is left untouched: cross-process and
//! cross-vendor discovery still run over SPDP/SEDP. The fastpath is
//! purely **additive** — the SEDP cache inserts and the endpoint
//! matching are idempotent (GUID-keyed and `add_*_proxy`-idempotent,
//! respectively), so an announcement that later additionally arrives
//! over UDP is a no-op.
use ;
use Vec;
use ;
use Ipv4Addr;
use Mutex;
use crateDcpsRuntime;
/// A registered in-process participant.
/// Process-global registry of all live runtimes.
static REGISTRY: = new;
/// Lock-free hint for the number of registered runtimes. Updated on
/// `register`; the reader hot path reads it without a lock and skips
/// the `peers()` vec allocation when no second peer exists (the common
/// cross-process bench case).
static REGISTRY_COUNT: AtomicUsize = new;
/// Registers a runtime. Call directly after the `Arc` wrap.
///
/// Dead entries (a `Weak` without a strong ref) are swept on every
/// registration — an explicit unregister on runtime drop is therefore
/// not needed.
pub
/// Lock-free hint: number of registered runtimes (including self).
/// `<= 1` ⇒ the caller may skip the `peers()` lookup path. If `2+`,
/// the caller MUST call `peers()` because there may be a real collision
/// (e.g. multi-DomainParticipant in-process tests).
pub
/// All live runtimes on `domain` + `group`. The result may contain the
/// caller itself — the caller filters by `GuidPrefix`.
pub