smb: figure out the best host to use for the UDS_URL
AbandonedPublic

Authored by sitter on Mar 6 2020, 4:03 PM.

Details

Reviewers
ngraham
dfaure
Summary

previously we simply used the ip address. this is fairly awkward though.
instead try to deduce a resolvable host name from the pretty name.

fallback order is now:
$prettyName.local (probably dnssd)
$prettyName (probably llmnr)
$ipAddr (neither worked)

because this is getting fairly expensive now: use async resolution for all
qhostinfos. even so, it's too blocking for my liking. it is holding up
dnssd discoveries a noticeable amount.

the more I poke this the more I feel like we might want to refactor most of
the resolver into a caching daemon. doing the discovery dance from scratch
on every listDir seems largely a waste of time. although, that seems
to be literally how it works on windows as well judging from the traffic.

Test Plan

wsdd on linux server resolves as expected, wsd on win10 also resolves as expected

Diff Detail

Repository
R320 KIO Extras
Branch
smb-unknowndevice-ensure-resolvability
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 23376
Build 23394: arc lint + arc unit
sitter created this revision.Mar 6 2020, 4:03 PM
Restricted Application added projects: Dolphin, Frameworks. · View Herald TranscriptMar 6 2020, 4:03 PM
Restricted Application added subscribers: kfm-devel, kde-frameworks-devel. · View Herald Transcript
sitter requested review of this revision.Mar 6 2020, 4:03 PM
meven added a subscriber: meven.Mar 23 2020, 4:14 PM

Seems fine to me

I've actually had a better idea! Well kinda and it may be trickier to do.

We could move the resolution dance to actual resolution time so it stops having impact on discovery.
i.e. we just always use "smb://" + m_prettyName + ".local" as UDS_URL for discovery. Should the user then attempt to enter that directory we'll get a listDir call and we call smbc_opendir(), if that fails we simply redirect to the url without .local, if that fails we give up. This is in fact more in line with how windows does it anyway, it too will only resolve when you try to list a server, not when it gets discovered.
Obvious caveat is that either prettyname or prettyname.local must be resolvable as we cannot fall back to the IP anymore. But again, that's more in line with windows.

Thoughts?

sitter abandoned this revision.Apr 6 2020, 9:22 AM