2003-01-08 Havoc Pennington <hp@redhat.com>

* dbus/dbus-transport-unix.c (unix_do_iteration): add read/write
	to the select() as needed for authentication. (should be using
	_dbus_poll() not select, but for another day)

	* dbus/dbus.h: include dbus/dbus-protocol.h
This commit is contained in:
Havoc Pennington 2003-01-08 19:29:00 +00:00
parent 67e33fd845
commit 509bbe9bde
3 changed files with 51 additions and 12 deletions

View file

@ -1,3 +1,11 @@
2003-01-08 Havoc Pennington <hp@redhat.com>
* dbus/dbus-transport-unix.c (unix_do_iteration): add read/write
to the select() as needed for authentication. (should be using
_dbus_poll() not select, but for another day)
* dbus/dbus.h: include dbus/dbus-protocol.h
2003-01-08 Anders Carlsson <andersca@codefactory.se>
* dbus/Makefile.am (dbusinclude_HEADERS): Install

View file

@ -838,6 +838,7 @@ unix_messages_pending (DBusTransport *transport,
check_write_watch (transport);
}
/* FIXME use _dbus_poll(), not select() */
static void
unix_do_iteration (DBusTransport *transport,
unsigned int flags,
@ -854,20 +855,49 @@ unix_do_iteration (DBusTransport *transport,
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.
*/
FD_ZERO (&read_set);
if (flags & DBUS_ITERATION_DO_READING)
{
FD_SET (unix_transport->fd, &read_set);
do_select = TRUE;
}
FD_ZERO (&write_set);
if (flags & DBUS_ITERATION_DO_WRITING)
if (_dbus_transport_get_is_authenticated (transport))
{
FD_SET (unix_transport->fd, &write_set);
do_select = TRUE;
if (flags & DBUS_ITERATION_DO_READING)
{
FD_SET (unix_transport->fd, &read_set);
do_select = TRUE;
}
if (flags & DBUS_ITERATION_DO_WRITING)
{
FD_SET (unix_transport->fd, &write_set);
do_select = TRUE;
}
}
else
{
DBusAuthState auth_state;
auth_state = _dbus_auth_do_work (transport->auth);
if (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)
{
FD_SET (unix_transport->fd, &write_set);
do_select = TRUE;
}
}
if (do_select)
{
@ -915,9 +945,9 @@ unix_do_iteration (DBusTransport *transport,
need_read, need_write);
do_authentication (transport, need_read, need_write);
if (need_read)
if (need_read && (flags & DBUS_ITERATION_DO_READING))
do_reading (transport);
if (need_write)
if (need_write && (flags & DBUS_ITERATION_DO_WRITING))
do_writing (transport);
}
}

View file

@ -31,6 +31,7 @@
#include <dbus/dbus-macros.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-message-handler.h>
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-server.h>
#include <dbus/dbus-threads.h>
#include <dbus/dbus-types.h>