After some playing around with Stephen patch and adding some debugging I
finally understood how DBUS likes to deal with watches.
We erroneously assumed that DBUS would add only one watch per FD.
It doesn't, instead it always adds 2 watches.
One to catch read events and one to catch write events.
It then proceed to always keep one of the 2 disabled when the other is
enabled, and it always toggles both when it needs to reverse access to
the file descriptor.
The following patch keeps track of sbus-watches/fd pairs and allocate
both DBusWatches to the same structure.
So far testing seem to confirm this approach works as expected.
Simo.
--
Simo Sorce * Red Hat, Inc * New York