Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "mdns"
version = "3.0.0"
authors = ["Dylan McKay <me@dylanmckay.io>"]
name = "mdns2"
version = "3.1.0"
authors = ["Dylan McKay <me@dylanmckay.io>", "Carsten Csiky <github@csicar.de>"]
edition = "2018"

description = """
Expand All @@ -11,11 +11,11 @@ Supports discovery of any mDNS device on a LAN.
"""

license = "MIT"
documentation = "https://docs.rs/mdns"
repository = "https://github.com/dylanmckay/mdns"
documentation = "https://docs.rs/mdns2"
repository = "https://github.com/csicar/mdns2"

categories = ["network-programming"]
keywords = ["mdns", "dns", "multicast", "chromecast", "discovery"]
keywords = ["mdns", "dns", "multicast", "chromecast", "discovery", "dns-sd"]

[dependencies]
dns-parser = "0.8.0"
Expand Down
9 changes: 8 additions & 1 deletion src/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ where
})
}

/// Returns a stream that produces an Item with a delay of `duration`.
/// In contrast to async_std's internal, the first item is created **instantly**.
fn instant_interval(duration: Duration) -> impl Stream<Item = ()> {
async_std::stream::once(()).chain(async_std::stream::interval(duration))
}

impl Discovery {
/// Sets whether or not we should ignore empty responses.
///
Expand All @@ -93,7 +99,8 @@ impl Discovery {
let response_stream = self.mdns_listener.listen().map(StreamResult::Response);
let sender = self.mdns_sender.clone();

let interval_stream = async_std::stream::interval(self.send_request_interval)

let interval_stream = instant_interval(self.send_request_interval)
// I don't like the double clone, I can't find a prettier way to do this
.map(move |_| {
let mut sender = sender.clone();
Expand Down