--- dbus-transport-unix.c.~1.37.~ 2004-07-23 03:23:02.061060197 +0200 +++ dbus-transport-unix.c 2004-07-23 03:56:52.355889351 +0200 @@ -721,7 +721,7 @@ (flags & DBUS_WATCH_READABLE)) { #if 1 - _dbus_verbose ("handling read watch\n"); + _dbus_verbose ("handling read watch (%x)\n", flags); #endif if (!do_authentication (transport, TRUE, FALSE)) return FALSE; @@ -763,8 +763,16 @@ } #endif /* DBUS_ENABLE_VERBOSE_MODE */ - if (flags & (DBUS_WATCH_HANGUP | DBUS_WATCH_ERROR)) + /* Disconnect in case of an error. In case of hangup do not + * disconnect the transport here because do_reading may have hit its + * max_bytes_read_per_iteration limit and some data may be left to + * read. The condition where flags == HANGUP (without READABLE) + * probably never happen in fact. + */ + if ((flags & DBUS_WATCH_ERROR) || + ((flags & DBUS_WATCH_HANGUP) && !(flags & DBUS_WATCH_READABLE))) { + _dbus_verbose ("Hang up or error on watch\n"); _dbus_transport_disconnect (transport); return TRUE; }