Skip to content

smb: refactor smbc discovery

Harald Sitter requested to merge work/smbcdiscoverer into master

this now too is based on the discovery design used for WSD and DNSSD. advantage being that we can then de-duplicate ALL discovieries through a single code path.

since smbc technically is meant to be used in a dirent while(){} way I am pulling some tricks here to get this nicer balanced via the event loop. ideally smbc would be thread safe or at least allow for multiple contexts, but currently both scenarios aren't working due to upstream bugs :( so instead of actually blocking while looping each loop cycle is posted through the event loop. this gives the other discoverers a chance to get their signal events in and not get stuck waiting for smbc to do its thing.

specifically also dnssd/wsd are started before smbc (if applicable anyway) so they get a head start speed things up quite a bit as previously they had to wait for smbc to do a full listing.

the discoverer discovers a new smbcdiscovery which isn't terribly interesting but allows for a much more readable loop logic. furthermore the readdirplus2 ifdefs have been shuffled a bit, also with the goal of easing readability.

Merge request reports