summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-transport-unix.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-26 06:42:57 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-26 06:42:57 +0000
commit7265423411609c14ddb9e6643463b840afcaa09b (patch)
tree199b4d4bee1531333292518bf83425eb01ad2fd3 /dbus/dbus-transport-unix.c
parent3781f063a6dfbdeafea6d1c6c8ac10c8b22f8586 (diff)
2003-02-26 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c (dbus_connection_send_message_with_reply_and_block): fix crash where we ref'd the outgoing message instead of the returned reply * dbus/dbus-transport-unix.c (do_authentication): check read watch at the end of this function, so if we didn't need to read for authentication, we reinstall it for receiving messages * dbus/dbus-message.c (dbus_message_new_reply): allow replies to a NULL sender for peer-to-peer case * dbus/dbus-transport-unix.c (check_read_watch): handle !authenticated case correctly * glib/dbus-gmain.c: add support for DBusServer * dbus/dbus-server.c: add data slot support * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): check return values and handle errors * dbus/dbus-dataslot.c: factor out the data slot stuff from DBusConnection * Doxyfile.in (INPUT): add glib subdir * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): rename setup_with_g_main instead of hookup_with_g_main; write docs
Diffstat (limited to 'dbus/dbus-transport-unix.c')
-rw-r--r--dbus/dbus-transport-unix.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c
index b30dc1d6..81c18b4a 100644
--- a/dbus/dbus-transport-unix.c
+++ b/dbus/dbus-transport-unix.c
@@ -157,7 +157,12 @@ check_write_watch (DBusTransport *transport)
_dbus_watch_unref (unix_transport->write_watch);
unix_transport->write_watch = NULL;
}
-
+ else
+ {
+ _dbus_verbose ("Write watch is unchanged from %p on fd %d\n",
+ unix_transport->write_watch, unix_transport->fd);
+ }
+
out:
_dbus_transport_unref (transport);
}
@@ -173,9 +178,16 @@ check_read_watch (DBusTransport *transport)
_dbus_transport_ref (transport);
- need_read_watch =
- _dbus_counter_get_value (transport->live_messages_size) < transport->max_live_messages_size;
+ if (_dbus_transport_get_is_authenticated (transport))
+ need_read_watch =
+ _dbus_counter_get_value (transport->live_messages_size) < transport->max_live_messages_size;
+ else
+ need_read_watch = transport->receive_credentials_pending ||
+ _dbus_auth_do_work (transport->auth) == DBUS_AUTH_STATE_WAITING_FOR_INPUT;
+ _dbus_verbose ("need_read_watch = %d authenticated = %d\n",
+ need_read_watch, _dbus_transport_get_is_authenticated (transport));
+
if (transport->disconnected)
need_read_watch = FALSE;
@@ -213,7 +225,12 @@ check_read_watch (DBusTransport *transport)
_dbus_watch_unref (unix_transport->read_watch);
unix_transport->read_watch = NULL;
}
-
+ else
+ {
+ _dbus_verbose ("Read watch is unchanged from %p on fd %d\n",
+ unix_transport->read_watch, unix_transport->fd);
+ }
+
out:
_dbus_transport_unref (transport);
}
@@ -552,6 +569,7 @@ do_authentication (DBusTransport *transport,
}
out:
+ check_read_watch (transport);
check_write_watch (transport);
_dbus_transport_unref (transport);
}
@@ -902,10 +920,12 @@ unix_do_iteration (DBusTransport *transport,
dbus_bool_t do_select;
int select_res;
- _dbus_verbose (" iteration flags = %s%s timeout = %d\n",
+ _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);
+ timeout_milliseconds,
+ unix_transport->read_watch,
+ unix_transport->write_watch);
/* "again" has to be up here because on EINTR the fd sets become
* undefined
@@ -948,13 +968,15 @@ unix_do_iteration (DBusTransport *transport,
auth_state = _dbus_auth_do_work (transport->auth);
- if (auth_state == DBUS_AUTH_STATE_WAITING_FOR_INPUT)
+ if (transport->receive_credentials_pending ||
+ auth_state == DBUS_AUTH_STATE_WAITING_FOR_INPUT)
{
FD_SET (unix_transport->fd, &read_set);
do_select = TRUE;
}
- if (auth_state == DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND)
+ if (transport->send_credentials_pending ||
+ auth_state == DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND)
{
FD_SET (unix_transport->fd, &write_set);
do_select = TRUE;