christgau / wsdd

A Web Service Discovery host daemon.
MIT License
860 stars 101 forks source link

D-Bus listener #63

Open ismell opened 4 years ago

ismell commented 4 years ago

Samba uses the avahi-client/D-Bus to announce to avahi that a the server is available. WSDD currently relies on the rc system to ensure samba is started before wsdd.

wsdd could subscribe to the same messages that avahi listens for and then publish the service. This would allow wsdd to start before smbd and then when smbd is ready, it could announce the share. This would also have the advantage that if smbd dies, wsdd could remove the service.

christgau commented 3 years ago

IMO integrating D-Bus directly in wsdd appears to be show-stopper. There is hardly any way to do so without having hard dependencies on some kind of D-Bus library. This is something I really don't like to have.

My current approach to react on Samba's D-Bus notifications in wsdd would be the following:

  1. wsdd's existing "API" gets an extension that allows to enable and disable the host role. The API interface must be enabled explicitly. The current implementation of the API s*cks because the Python's TcpServer handles "requests" s*cks, i.e. it closes the connection to the client as soon as after a single request is handled. I intent to rewrite the networking code but that's a different story.
  2. Any kind of "glue application" can then use the API to enable and disable the host discovery dynamically at runtime without having the privilege to stop/start the service.
  3. One possible glue application might a D-Bus listener that handles announcements of Samba via D-Bus and controls wsdd accordingly. Such a "wsdd-dbus" (working title) application might be part of the wsdd package but a separate code base.
  4. In the same way "wsdd-dbus" can be used to provide information about discovered hosts via D-Bus to other applications as desired in #56.

Does that sound like a possible solution?

alexpevzner commented 1 month ago

Hi,

sorry for probably out of date comment.

Actually this is better not to subscribe to D-Bus messages that Avahi uses for its client/server communications, but instead, acting as Avahi client (I believe, Avahi client library for Python does exist), browse for the _smb._tcp service announces on DNS-SD that match the local host addresses.