diff options
author | Havoc Pennington <hp@redhat.com> | 2004-11-26 01:53:13 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2004-11-26 01:53:13 +0000 |
commit | dbdea921b5967ed25b24a9e5af5d6a3db54c5ec7 (patch) | |
tree | e9224f077138d6e7d7c8ffe4dc4fb68ab6e0c355 /dbus/dbus-watch.c | |
parent | 2ce2ab4368d9b037c51cd3cb4ef39e3f7ade8b00 (diff) |
2004-11-25 Havoc Pennington <hp@redhat.com>
The primary change here is to always write() once before adding
the write watch, which gives us about a 10% performance increase.
* dbus/dbus-transport-unix.c: a number of modifications to cope
with removing messages_pending
(check_write_watch): properly handle
DBUS_AUTH_STATE_WAITING_FOR_MEMORY; adapt to removal of
messages_pending stuff
(check_read_watch): properly handle WAITING_FOR_MEMORY and
AUTHENTICATED cases
(unix_handle_watch): after writing, see if the write watch can be
removed
(unix_do_iteration): assert that write_watch/read_watch are
non-NULL rather than testing that they aren't, since they
aren't allowed to be NULL. check_write_watch() at the end so
we add the watch if we did not finish writing (e.g. got EAGAIN)
* dbus/dbus-transport-protected.h: remove messages_pending call,
since it resulted in too much inefficient watch adding/removing;
instead we now require that the transport user does an iteration
after queueing outgoing messages, and after trying the first
write() we add a write watch if we got EAGAIN or exceeded our
max bytes to write per iteration setting
* dbus/dbus-string.c (_dbus_string_validate_signature): add this
function
* dbus/dbus-server-unix.c (unix_finalize): the socket name was
freed and then accessed, valgrind flagged this bug, fix it
* dbus/dbus-message.c: fix several bugs where HEADER_FIELD_LAST was taken
as the last valid field plus 1, where really it is equal to the
last valid field. Corrects some message corruption issues.
* dbus/dbus-mainloop.c: verbosity changes
* dbus/dbus-keyring.c (_dbus_keyring_new_homedir): handle OOM
instead of aborting in one of the test codepaths
* dbus/dbus-internals.c (_dbus_verbose_real): fix a bug that
caused not printing the pid ever again if a verbose was missing
the newline at the end
(_dbus_header_field_to_string): add HEADER_FIELD_SIGNATURE
* dbus/dbus-connection.c: verbosity changes;
(dbus_connection_has_messages_to_send): new function
(_dbus_connection_message_sent): no longer call transport->messages_pending
(_dbus_connection_send_preallocated_unlocked): do one iteration to
try to write() immediately, so we can avoid the write watch. This
is the core purpose of this patchset
(_dbus_connection_get_dispatch_status_unlocked): if disconnected,
dump the outgoing message queue, so nobody will get confused
trying to send them or thinking stuff is pending to be sent
* bus/test.c: verbosity changes
* bus/driver.c: verbosity/assertion changes
* bus/dispatch.c: a bunch of little tweaks to get it working again
because this patchset changes when/where you need to block.
Diffstat (limited to 'dbus/dbus-watch.c')
-rw-r--r-- | dbus/dbus-watch.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index 02bfbb83..dbc0fb48 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -268,8 +268,27 @@ _dbus_watch_list_set_functions (DBusWatchList *watch_list, DBusList *next = _dbus_list_get_next_link (&watch_list->watches, link); - _dbus_verbose ("Adding a watch on fd %d using newly-set add watch function\n", - dbus_watch_get_fd (link->data)); +#ifdef DBUS_ENABLE_VERBOSE_MODE + { + const char *watch_type; + int flags; + + flags = dbus_watch_get_flags (link->data); + if ((flags & DBUS_WATCH_READABLE) && + (flags & DBUS_WATCH_WRITABLE)) + watch_type = "readwrite"; + else if (flags & DBUS_WATCH_READABLE) + watch_type = "read"; + else if (flags & DBUS_WATCH_WRITABLE) + watch_type = "write"; + else + watch_type = "not read or write"; + + _dbus_verbose ("Adding a %s watch on fd %d using newly-set add watch function\n", + watch_type, + dbus_watch_get_fd (link->data)); + } +#endif /* DBUS_ENABLE_VERBOSE_MODE */ if (!(* add_function) (link->data, data)) { @@ -402,8 +421,8 @@ _dbus_watch_list_toggle_watch (DBusWatchList *watch_list, if (watch_list->watch_toggled_function != NULL) { - _dbus_verbose ("Toggling watch on fd %d to %d\n", - dbus_watch_get_fd (watch), watch->enabled); + _dbus_verbose ("Toggling watch %p on fd %d to %d\n", + watch, dbus_watch_get_fd (watch), watch->enabled); (* watch_list->watch_toggled_function) (watch, watch_list->watch_data); |