Use LAN name from Avahi instead of assuming it's the D-Bus machine id.
This way p2p works as intended with any LAN name and also works if
it's changed on the fly via D-Bus using e.g. the gdbus command like
this:
# gdbus call --system --dest org.freedesktop.Avahi --object-path / \
--method org.freedesktop.Avahi.Server.SetHostName some-new-lan-name
Notably, this change allows us to delete all the code dealing with
obtaining the D-Bus machine-id.
BUG=chromium:245758
TEST=Unit tests pass + Changed LAN name (via the gdbus command) while
avahi-daemon and p2p-server was running and checked (via the
p2p-client command) that other devices could still see files
exported by the devices, under the new name.
Change-Id: Idb1d47ff5feadd0e51eb0be39e906aa3ad659952
Reviewed-on: https://chromium-review.googlesource.com/171480
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
4 files changed