Index: dbus/dbus-transport-unix.c =================================================================== RCS file: /cvs/dbus/dbus/dbus/dbus-transport-unix.c,v retrieving revision 1.36 diff -u -u -r1.36 dbus-transport-unix.c --- dbus/dbus-transport-unix.c 17 May 2004 23:34:55 -0000 1.36 +++ dbus/dbus-transport-unix.c 21 Jul 2004 18:46:14 -0000 @@ -566,7 +566,7 @@ /* returns false on out-of-memory */ static dbus_bool_t -do_reading (DBusTransport *transport) +do_reading (DBusTransport *transport, dbus_bool_t about_to_hangup) { DBusTransportUnix *unix_transport = (DBusTransportUnix*) transport; DBusString *buffer; @@ -587,7 +587,7 @@ /* See if we've exceeded max messages and need to disable reading */ check_read_watch (transport); - if (total > unix_transport->max_bytes_read_per_iteration) + if (total > unix_transport->max_bytes_read_per_iteration && !about_to_hangup) { _dbus_verbose ("%d bytes exceeds %d bytes read per iteration, returning\n", total, unix_transport->max_bytes_read_per_iteration); @@ -686,7 +686,7 @@ total += bytes_read; - if (_dbus_transport_queue_messages (transport) == DBUS_DISPATCH_NEED_MEMORY) + if (!_dbus_transport_queue_messages (transport)) { oom = TRUE; _dbus_verbose (" out of memory when queueing messages we just read in the transport\n"); @@ -720,13 +720,14 @@ if (watch == unix_transport->read_watch && (flags & DBUS_WATCH_READABLE)) { + dbus_bool_t about_to_hangup = (flags & DBUS_WATCH_HANGUP) != 0; #if 1 _dbus_verbose ("handling read watch\n"); #endif if (!do_authentication (transport, TRUE, FALSE)) return FALSE; - if (!do_reading (transport)) + if (!do_reading (transport, about_to_hangup)) { _dbus_verbose ("no memory to read\n"); return FALSE; @@ -765,6 +766,7 @@ if (flags & (DBUS_WATCH_HANGUP | DBUS_WATCH_ERROR)) { + _dbus_verbose ("Hangup or error on watch\n"); _dbus_transport_disconnect (transport); return TRUE; } @@ -914,13 +916,14 @@ { dbus_bool_t need_read = (poll_fd.revents & _DBUS_POLLIN) > 0; dbus_bool_t need_write = (poll_fd.revents & _DBUS_POLLOUT) > 0; + dbus_bool_t about_to_hangup = (poll_fd.revents & _DBUS_POLLHUP) > 0; _dbus_verbose ("in iteration, need_read=%d need_write=%d\n", need_read, need_write); do_authentication (transport, need_read, need_write); if (need_read && (flags & DBUS_ITERATION_DO_READING)) - do_reading (transport); + do_reading (transport, about_to_hangup); if (need_write && (flags & DBUS_ITERATION_DO_WRITING)) do_writing (transport); }