pub struct LanDiscovery { /* private fields */ }Implementations§
Source§impl LanDiscovery
impl LanDiscovery
Sourcepub fn get_all_instances(&self) -> Vec<LanInstance>
pub fn get_all_instances(&self) -> Vec<LanInstance>
Every live entry, an instance found at two addresses once for each: what to match an
incoming connection’s source address against, which may be either. Anything that lists or
targets peers reads get_instances (each instance once) instead.
Source§impl LanDiscovery
impl LanDiscovery
Sourcepub fn start(
instance_id: String,
hostname: String,
version: String,
port: u16,
auth_key: String,
event_bus: Arc<EventBus>,
) -> Result<Arc<Self>, String>
pub fn start( instance_id: String, hostname: String, version: String, port: u16, auth_key: String, event_bus: Arc<EventBus>, ) -> Result<Arc<Self>, String>
Start LAN discovery: register this instance and browse for peers.
Sourcepub fn health(&self) -> MdnsHealth
pub fn health(&self) -> MdnsHealth
Is this instance really announced on an IPv4 interface other machines
can reach? Pending until the start-up grace has passed.
Sourcepub fn get_instances(&self) -> Vec<LanInstance>
pub fn get_instances(&self) -> Vec<LanInstance>
Get current list of discovered LAN peers (excludes self), each instance once (one_per_instance).
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Get peer count (excludes self).
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Stop the mDNS daemon and the UDP broadcast-probe responder.
The mDNS side synchronously closes the daemon socket (UDP:5353),
causing the browse_receiver to return Err and the event-loop thread
spawned by start() to exit. The UDP responder is stopped by firing
its cancellation channel, which the tokio::select! in
udp_responder_loop is racing against recv_from — this is what
makes a live setting toggle actually stop responding to probes, not
just stop the mDNS advertisement.
Required for live-disable to actually stop discovery: both background
tasks hold their own Arc<Self> clone, so simply dropping the
controller’s Arc never reaches refcount zero and Drop does not
run. Callers must invoke shutdown() before clearing their Arc.
Idempotent — safe to call from both the explicit path and Drop.
Trait Implementations§
Source§impl Drop for LanDiscovery
impl Drop for LanDiscovery
Auto Trait Implementations§
impl !Freeze for LanDiscovery
impl !RefUnwindSafe for LanDiscovery
impl !UnwindSafe for LanDiscovery
impl Send for LanDiscovery
impl Sync for LanDiscovery
impl Unpin for LanDiscovery
impl UnsafeUnpin for LanDiscovery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more