- if (!_dbus_connection_add_watch (transport->connection,
- unix_transport->read_watch))
- {
- _dbus_connection_remove_watch (transport->connection,
- unix_transport->write_watch);
- return FALSE;
- }
-
- check_read_watch (transport);
- check_write_watch (transport);
-
- return TRUE;
-}
-
-static void
-unix_messages_pending (DBusTransport *transport,
- int messages_pending)
-{
- check_write_watch (transport);
-}
-
-/* FIXME use _dbus_poll(), not select() */
-/**
- * @todo We need to have a way to wake up the select sleep if
- * a new iteration request comes in with a flag (read/write) that
- * we're not currently serving. Otherwise a call that just reads
- * could block a write call forever (if there are no incoming
- * messages).
- */
-static void
-unix_do_iteration (DBusTransport *transport,
- unsigned int flags,
- int timeout_milliseconds)
-{
- DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
- fd_set read_set;
- fd_set write_set;
- dbus_bool_t do_select;
- int select_res;
-
- _dbus_verbose (" iteration flags = %s%s timeout = %d read_watch = %p write_watch = %p\n",
- flags & DBUS_ITERATION_DO_READING ? "read" : "",
- flags & DBUS_ITERATION_DO_WRITING ? "write" : "",
- timeout_milliseconds,
- unix_transport->read_watch,
- unix_transport->write_watch);
-
- /* "again" has to be up here because on EINTR the fd sets become
- * undefined
- */
- again:
-
- do_select = FALSE;
-
- /* the passed in DO_READING/DO_WRITING flags indicate whether to
- * read/write messages, but regardless of those we may need to block
- * for reading/writing to do auth. But if we do reading for auth,
- * we don't want to read any messages yet if not given DO_READING.
- *
- * Also, if read_watch == NULL or write_watch == NULL, we don't
- * want to read/write so don't.
- */
-
- FD_ZERO (&read_set);
- FD_ZERO (&write_set);
-
- if (_dbus_transport_get_is_authenticated (transport))
- {
- if (unix_transport->read_watch &&
- (flags & DBUS_ITERATION_DO_READING))
- {
- FD_SET (unix_transport->fd, &read_set);
- do_select = TRUE;
- }
-
- if (unix_transport->write_watch &&
- (flags & DBUS_ITERATION_DO_WRITING))