Commit 5bb4464
committed
fix(discovery): cache primary IP by service instance, not SRV target
The dialer's `primary_hints` lookup keys on the configured `hostname`
("JKMBP-M4-Max.local"), but the cache was being populated with the
SRV target hostname returned by `ServiceInfo::get_hostname()`. macOS
will sometimes appear in mDNS-SD with a suffixed system hostname
("JKMBP-M4-Max-2.local") for the SRV record while the service-instance
label keeps the user-visible identifier ("JKMBP-M4-Max.local") — those
two names are advertised together but mdns-sd resolves only one
SRV target into the event, so the cache key drifted to a name the
config never references and `preferred` came back None.
Switch the cache key to the service-instance label, parsed off the
fullname's `.<SERVICE_TYPE>` suffix. The label is what users put in
their config (the announcer derives it from the same `local_hostname()`
on registration) and it's stable across SRV-target variations.
Log line now shows both fields so future hostname/target mismatches
are visible without a packet capture:
mdns: peer instance=jkmbp-m4-max.local (target=jkmbp-m4-max-2.local) ...1 parent 0a636ed commit 5bb4464
1 file changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
| |||
291 | 307 | | |
292 | 308 | | |
293 | 309 | | |
294 | | - | |
| 310 | + | |
295 | 311 | | |
296 | 312 | | |
297 | 313 | | |
298 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
299 | 318 | | |
300 | | - | |
301 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
302 | 322 | | |
303 | | - | |
| 323 | + | |
304 | 324 | | |
305 | 325 | | |
306 | 326 | | |
| |||
0 commit comments