File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed
Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 22name = " libmdns"
33version = " 0.9.1"
44authors = [" Will Stott <willstott101+libmdns@gmail.com>" ]
5-
65description = " mDNS Responder library for building discoverable LAN services in Rust"
76repository = " https://github.com/librespot-org/libmdns"
87readme = " README.md"
@@ -11,19 +10,23 @@ edition = "2018"
1110
1211[dependencies ]
1312byteorder = " 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"
1913futures-util = " 0.3"
20- thiserror = " 1.0"
21- tokio = { version = " 1.0" , features = [" sync" , " net" , " rt" ] }
22- socket2 = { version = " 0.5" , features = [" all" ] }
14+ hostname = " 0.4"
15+ if-addrs = { version = " 0.14" , features = [" link-local" ] }
16+ log = " 0.4"
17+ multimap = { version = " 0.10" , default-features = false }
18+ rand = " 0.9"
19+ socket2 = { version = " 0.6" , features = [" all" ] }
20+ thiserror = " 2"
21+ tokio = { version = " 1" , default-features = false , features = [
22+ " sync" ,
23+ " net" ,
24+ " rt" ,
25+ ] }
2326
2427[dev-dependencies ]
25- env_logger = { version = " 0.10.2 " , default-features = false , features = [
26- " color" ,
27- " humantime" ,
28- " auto-color" ,
28+ env_logger = { version = " 0.11 " , default-features = false , features = [
29+ " color" ,
30+ " humantime" ,
31+ " auto-color" ,
2932] }
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