- else if (bytes_read == 0)
- {
- _dbus_verbose ("Disconnected from remote app\n");
- do_io_error (transport);
- goto out;
- }
- else
- {
- _dbus_verbose (" read %d bytes\n", bytes_read);
-
- total += bytes_read;
-
- queue_messages (transport);
-
- /* Try reading more data until we get EAGAIN and return, or
- * exceed max bytes per iteration. If in blocking mode of
- * course we'll block instead of returning.
- */
- goto again;
- }
-
- out:
- return; /* I think some C compilers require a statement after a label */
-}
-
-static void
-unix_handle_watch (DBusTransport *transport,
- DBusWatch *watch,
- unsigned int flags)
-{
- DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
-
- _dbus_assert (watch == unix_transport->read_watch ||
- watch == unix_transport->write_watch);
-
- if (flags & (DBUS_WATCH_HANGUP | DBUS_WATCH_ERROR))
- {
- _dbus_transport_disconnect (transport);
- return;
- }
-
- if (watch == unix_transport->read_watch &&
- (flags & DBUS_WATCH_READABLE))
- {
-#if 0
- _dbus_verbose ("handling read watch\n");
-#endif
- do_authentication (transport, TRUE, FALSE);
- do_reading (transport);
- }
- else if (watch == unix_transport->write_watch &&
- (flags & DBUS_WATCH_WRITABLE))
- {
-#if 0
- _dbus_verbose ("handling write watch\n");
-#endif
- do_authentication (transport, FALSE, TRUE);
- do_writing (transport);
- }
-}
-
-static void
-unix_disconnect (DBusTransport *transport)
-{
- DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
-
- free_watches (transport);
-
- _dbus_close (unix_transport->fd, NULL);
- unix_transport->fd = -1;
-}
-
-static dbus_bool_t
-unix_connection_set (DBusTransport *transport)
-{
- DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport;
-
- if (!_dbus_connection_add_watch (transport->connection,
- unix_transport->write_watch))
- return FALSE;
-
- if (!_dbus_connection_add_watch (transport->connection,
- unix_transport->read_watch))