sd-bus requires that sd_bus_get_fd, sd_bus_get_events, and sd_bus_get_timeout are called for every invocation of poll, and the returned FD, events, and timeout used. In particular, sd-bus may return events=0 and timeout=0 if it already has dbus messages to process in its receive queue.
xdpw currently doesn't call sd_bus_get_events or sd_bus_get_timeout at all. This can result in the situation where xdpw goes into a poll with no timeout and a message in sd-bus' receive queue is never handled until another dbus message arrives. I have a case where this ignored messages causes xdg-desktop-portal to hang.
This commit changes the polling code to match sd-bus' requirements.
sd-bus requires that
sd_bus_get_fd
,sd_bus_get_events
, andsd_bus_get_timeout
are called for every invocation ofpoll
, and the returned FD, events, and timeout used. In particular, sd-bus may returnevents=0
andtimeout=0
if it already has dbus messages to process in its receive queue.xdpw currently doesn't call
sd_bus_get_events
orsd_bus_get_timeout
at all. This can result in the situation where xdpw goes into apoll
with no timeout and a message in sd-bus' receive queue is never handled until another dbus message arrives. I have a case where this ignored messages causes xdg-desktop-portal to hang.This commit changes the polling code to match sd-bus' requirements.
Fixes #281