Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query for unresolved instances only when needed #157

Merged
merged 8 commits into from
Dec 21, 2023
Merged

Conversation

keepsimple1
Copy link
Owner

@keepsimple1 keepsimple1 commented Dec 19, 2023

This patch is to solve issue #156 . The main change is to add a new internal command Command::Resolve to query unresolved instances. Such commands are only issued for active queries and are limited to twice, per 0.5 second.

Ran manual test:

  • change broadcast_service_on_intf to only send PTR record, not SRV, TXT records.
  • added println to show the Command::Resolve triggered properly.
  • verified SRV query only sent once and stopped when successful.
  • verified pending_resolves updated properly.

manual test log:

At 3.571128911s : ServiceFound("_no-srv._tcp.local.", "test3._no-srv._tcp.local.")
SystemTime { tv_sec: 1703194637, tv_nsec: 434398000 } exec Command::Resolve for test3._no-srv._tcp.local. try_count 1
SystemTime { tv_sec: 1703194637, tv_nsec: 434462000 } send query for TYPE_ANY for test3._no-srv._tcp.local.
At 4.072879335s: Resolved a new service: test3._no-srv._tcp.local. host: mdns-example.local. port: 3456 IP: {fe80::25ca:74bd:9126:8e57, fe80::1, fe80::235d:96fc:aee0:2a0c, fe80::1846:93a2:ca2a:a09b, fe80::ce81:b1c:bd2c:69e, fe80::8511:a836:fa4a:726f, fe80::70ca:4bb:f4a5:e9a8, 192.168.0.107, fe80::e5a8:1e17:be1:b792, fe80::dc77:60ff:fe7b:ad42, fe80::b0e8:4591:c003:25b0} TXT properties: TxtProperties { properties: [TxtProperty {key: "PATH", val: Some("one")}] }
SystemTime { tv_sec: 1703194637, tv_nsec: 934134000 } exec Command::Resolve for test3._no-srv._tcp.local. try_count 2
SystemTime { tv_sec: 1703194637, tv_nsec: 934159000 } SRV record already exists for test3._no-srv._tcp.local.

test log for pending_resolves:

At 3.76635187s : ServiceFound("_no-srv._tcp.local.", "test3._no-srv._tcp.local.")
adding a new pending resolve
pending_resolves count: 1
pending_resolves count: 1
pending_resolves count: 1
pending_resolves count: 1
exec Command::Resolve for test3._no-srv._tcp.local. try_count 1
send query for missing SRV test3._no-srv._tcp.local.
pending_resolves count: 0
At 4.269338215s: Resolved a new service: test3._no-srv._tcp.local. host: mdns-example.local. port: 3456 IP: {fe80::25ca:74bd:9126:8e57, fe80::e5a8:1e17:be1:b792, fe80::1846:93a2:ca2a:a09b, fe80::235d:96fc:aee0:2a0c, fe80::ce81:b1c:bd2c:69e, fe80::1, fe80::b0e8:4591:c003:25b0, 192.168.0.107, fe80::70ca:4bb:f4a5:e9a8, fe80::8511:a836:fa4a:726f, fe80::dc77:60ff:fe7b:ad42} TXT properties: TxtProperties { properties: [TxtProperty {key: "PATH", val: Some("one")}] }
pending_resolves count: 0
pending_resolves count: 0
exec Command::Resolve for test3._no-srv._tcp.local. try_count 2
pending_resolves count: 0

src/service_daemon.rs Outdated Show resolved Hide resolved
@keepsimple1 keepsimple1 merged commit 83b4a99 into main Dec 21, 2023
3 checks passed
@keepsimple1 keepsimple1 deleted the limit-query branch December 21, 2023 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants