Skip to content

Commit

Permalink
fixup: naming + remove leftover comment
Browse files Browse the repository at this point in the history
  • Loading branch information
oysteintveit-nordicsemi committed Apr 16, 2024
1 parent d1eb6d3 commit 69e6da2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions src/service_daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ impl ServiceDaemon {
call_hostname_resolution_listener(
&zc.hostname_resolvers,
hostname,
HostnameResolutionEvent::HostnameAddressesRemoved(
HostnameResolutionEvent::AddressesRemoved(
hostname.to_string(),
zc.cache.get_addresses_for_host(hostname),
),
Expand Down Expand Up @@ -1122,7 +1122,6 @@ impl Zeroconf {
my_services: HashMap::new(),
cache: DnsCache::new(),
hostname_resolvers: HashMap::new(),
// hostname_resolver_timeouts: HashMap::new(),
service_queriers: HashMap::new(),
retransmissions: Vec::new(),
counters: HashMap::new(),
Expand Down Expand Up @@ -1723,7 +1722,7 @@ impl Zeroconf {
) {
let addresses = self.cache.get_addresses_for_host(hostname);
if !addresses.is_empty() {
match sender.send(HostnameResolutionEvent::HostnameAddressesFound(
match sender.send(HostnameResolutionEvent::AddressesFound(
hostname.to_string(),
addresses,
)) {
Expand Down Expand Up @@ -1887,10 +1886,7 @@ impl Zeroconf {
call_hostname_resolution_listener(
&self.hostname_resolvers,
hostname,
HostnameResolutionEvent::HostnameAddressesFound(
hostname.to_string(),
addresses,
),
HostnameResolutionEvent::AddressesFound(hostname.to_string(), addresses),
)
});

Expand Down Expand Up @@ -2156,9 +2152,9 @@ pub enum HostnameResolutionEvent {
/// Started searching for the ip address of a hostname.
SearchStarted(String),
/// One or more addresses for a hostname has been found.
HostnameAddressesFound(String, HashSet<IpAddr>),
AddressesFound(String, HashSet<IpAddr>),
/// One or more addresses for a hostname has been removed.
HostnameAddressesRemoved(String, HashSet<IpAddr>),
AddressesRemoved(String, HashSet<IpAddr>),
/// The search for the ip address of a hostname has timed out.
SearchTimeout(String),
/// Stopped searching for the ip address of a hostname.
Expand Down
4 changes: 2 additions & 2 deletions tests/mdns_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ fn test_hostname_resolution() {
let event_receiver = d.resolve_hostname(hostname, Some(2000)).unwrap();
let resolved = loop {
match event_receiver.recv() {
Ok(HostnameResolutionEvent::HostnameAddressesFound(found_hostname, addresses)) => {
Ok(HostnameResolutionEvent::AddressesFound(found_hostname, addresses)) => {
assert!(found_hostname == hostname);
assert!(addresses.contains(&service_ip_addr));
break true;
Expand Down Expand Up @@ -1106,7 +1106,7 @@ fn hostname_resolution_timeout() {
let event_receiver = d.resolve_hostname(hostname, Some(2000)).unwrap();
let resolved = loop {
match event_receiver.recv() {
Ok(HostnameResolutionEvent::HostnameAddressesFound(found_hostname, _addresses)) => {
Ok(HostnameResolutionEvent::AddressesFound(found_hostname, _addresses)) => {
assert!(found_hostname == hostname);
break true;
}
Expand Down

0 comments on commit 69e6da2

Please sign in to comment.