Jan Djärv<address@hidden> writes:
* dbus_fd_cb calls only xd_read_queued_messages. Couldn't both functions
be merged? Or, since we have the file descriptor in the callback,
shouldn't we call only xd_read_message for that socket?
Yes and yes. I was lazy, I saw that xd_read_queued_messages wasn't
static and kept it just in case. I wasn't sure how to get the
DbusConnection from a fd so I skipped that. But feel free to make any
changes you think appropriate. I don't think xd_get_dispatch_status
and xd_pending_messages are used for example.
I've tried to adapt it as much as possible. I've kept
xd_read_queued_messages in order to be able to catch errors from
xd_read_message.
* We assume that communication is socket base. This must not be true;
see the comment in
<http://dbus.freedesktop.org/doc/dbus/api/html/group__DBusConnection.html#gb9b8b4064fe2bc36f89f399f32979398>.
If
xd_find_watch_fd returns -1, we shall raise an error at least.
I'm not sure what you mean. If you look at the code, the functions
dbus_watch_get_fd, dbus_watch_get_unix_fd and dbus_watch_get_socket
all return the same thing, watch->fd. We don't really assume socket,
any fd that can be passed to select will do. In practice on Unix-like
systems, we can't get -1 (minus dbus-bugs of course).
Yes, you are right. If dbus_watch_get* returns something less than zero,
we silently return as well. This might be sufficient.