Skip to main content

self_primary_endpoint

Function self_primary_endpoint 

Source
pub fn self_primary_endpoint(relay_state: &Value) -> Option<Endpoint>
Expand description

v0.9 canonical single-reader for “my best inbound slot.” Returns the first endpoint from self_endpoints() — which is already priority-ordered (UDS → Local-with-matching-self → LAN → Federation) AND back-compat-falls-back to legacy top-level fields.

Replaces ad-hoc self_state["relay_url"].as_str() reads scattered through the codebase. Pre-v0.9 those bare reads were the silent- fail root cause: a session with only self.endpoints[] (no legacy top-level fields) returned empty strings instead of the available endpoint, and pair_drop_ack / pull / rotate-slot all silently no-op’d. Always use this from new code.