File tree Expand file tree Collapse file tree 3 files changed +33
-27
lines changed
Expand file tree Collapse file tree 3 files changed +33
-27
lines changed Original file line number Diff line number Diff line change @@ -4,25 +4,26 @@ on: [push, pull_request]
44
55jobs:
66 build:
7+
78 runs-on: ubuntu-latest
89
910 steps:
10- - uses: actions/checkout@v1
11+ - uses: actions/checkout@v1
1112
12- - name: Install our MSRV
13- uses: dtolnay/rust-toolchain@stable
14- with:
15- toolchain: "1.74"
13+ - name: Install our MSRV
14+ uses: dtolnay/rust-toolchain@stable
15+ with:
16+ toolchain: "1.74"
1617
17- - name: Compile example
18- run: cargo build --example register
18+ - name: Compile example
19+ run: cargo build --example register
1920
20- - name: Install dependencies
21- run: |
22- sudo apt-get -y install python3-setuptools python3-wheel
23- pip3 install --user zeroconf
21+ - name: Install dependencies
22+ run: |
23+ sudo apt-get -y install python3-setuptools python3-wheel
24+ pip3 install --user zeroconf
2425
25- - name: Test zeroconf
26- run: |
27- timeout 5 cargo run --example register &
28- python3 examples/zeroconf_test.py
26+ - name: Test zeroconf
27+ run: |
28+ timeout 5 cargo run --example register &
29+ python3 examples/zeroconf_test.py
Original file line number Diff line number Diff line change @@ -11,18 +11,22 @@ rust-version = "1.74"
1111
1212[dependencies]
1313byteorder = "1.5"
14- if-addrs = { version = "0.12.0", features = ["link-local"] }
15- hostname = "0.4.0"
16- log = "0.4"
17- multimap = "0.10.0"
18- rand = "0.8"
1914futures-util = "0.3"
20- thiserror = "1.0"
21- tokio = { version = "1.0", features = ["sync", "net", "rt"] }
22- socket2 = { version = "0.5", features = ["all"] }
15+ hostname = "0.4"
16+ if-addrs = { version = "0.14", features = ["link-local"] }
17+ log = "0.4"
18+ multimap = { version = "0.10", default-features = false }
19+ rand = "0.9"
20+ socket2 = { version = "0.6", features = ["all"] }
21+ thiserror = "2"
22+ tokio = { version = "1", default-features = false, features = [
23+ "sync",
24+ "net",
25+ "rt",
26+ ] }
2327
2428[dev-dependencies]
25- env_logger = { version = "0.10.2 ", default-features = false, features = [
29+ env_logger = { version = "0.11 ", default-features = false, features = [
2630 "color",
2731 "humantime",
2832 "auto-color",
Original file line number Diff line number Diff line change 11use crate::dns_parser::{self, Name, QueryClass, RRData};
22use multimap::MultiMap;
3- use rand::{thread_rng , Rng};
3+ use rand::{rng , Rng};
44use std::collections::HashMap;
55use std::slice;
66use std::sync::{Arc, RwLock};
@@ -48,9 +48,10 @@ impl ServicesInner {
4848 }
4949
5050 pub fn register(&mut self, svc: ServiceData) -> usize {
51- let mut id = thread_rng().gen::<usize>();
51+ let random_usize = || rng().random_range(..=usize::MAX);
52+ let mut id = random_usize();
5253 while self.by_id.contains_key(&id) {
53- id = thread_rng().gen::<usize> ();
54+ id = random_usize ();
5455 }
5556
5657 self.by_type.insert(svc.typ.clone(), id);
You can’t perform that action at this time.
0 commit comments