flatpak / xdg-dbus-proxy

GNU Lesser General Public License v2.1
57 stars 21 forks source link

Query name owners just once #56

Open mardy opened 6 months ago

mardy commented 6 months ago

Since all clients connecting to the proxy share the same policy filters, we can setup the name owner data just once, when the first client connects, and store it in the FlatpakProxy object so that all other clients can use it.

This avoid duplicating the calls to ListNames and GetNameOwner.

Fixes: #55

Note: this works in my setup, but I wonder if I should call stop_reading() at the end of got_buffer_from_client() when the name_owners_state is NAME_OWNERS_WAITING and reinstate the reading once the state reaches NAME_OWNERS_READY; the comment on this invocation of stop_reading() seems to hint that we are just worried about the ordering of the serial numbers, so it should be fine like this, but I'm not sure.