/** * Processes data we've read while handling a watch, potentially * converting some of it to messages and queueing those messages on * the connection. * * @param transport the transport * @returns #TRUE if we had enough memory to queue all messages */ dbus_bool_t _dbus_transport_queue_messages (DBusTransport *transport) { DBusDispatchStatus status; #if 0 _dbus_verbose ("_dbus_transport_queue_messages()\n"); #endif /* Queue any messages */ while ((status = _dbus_transport_get_dispatch_status (transport)) == DBUS_DISPATCH_DATA_REMAINS) { DBusMessage *message; DBusList *link; link = _dbus_message_loader_pop_message_link (transport->loader); _dbus_assert (link != NULL); message = link->data; _dbus_verbose ("queueing received message %p\n", message); if (!_dbus_message_add_counter (message, transport->live_messages)) { _dbus_message_loader_putback_message_link (transport->loader, link); status = DBUS_DISPATCH_NEED_MEMORY; break; } else { /* We didn't call the notify function when we added the counter, so * catch up now. Since we have the connection's lock, it's desirable * that we bypass the notify function and call this virtual method * directly. */ if (transport->vtable->live_messages_changed) (* transport->vtable->live_messages_changed) (transport); /* pass ownership of link and message ref to connection */ _dbus_connection_queue_received_message_link (transport->connection, link); } } if (_dbus_message_loader_get_is_corrupted (transport->loader)) { _dbus_verbose ("Corrupted message stream, disconnecting\n"); _dbus_transport_disconnect (transport); } return status != DBUS_DISPATCH_NEED_MEMORY; }
/** * Processes data we've read while handling a watch, potentially * converting some of it to messages and queueing those messages on * the connection. * * @param transport the transport * @returns #TRUE if we had enough memory to queue all messages */ dbus_bool_t _dbus_transport_queue_messages (DBusTransport *transport) { DBusDispatchStatus status; #if 0 _dbus_verbose ("_dbus_transport_queue_messages()\n"); #endif /* Queue any messages */ while ((status = _dbus_transport_get_dispatch_status (transport)) == DBUS_DISPATCH_DATA_REMAINS) { DBusMessage *message; DBusList *link; link = _dbus_message_loader_pop_message_link (transport->loader); _dbus_assert (link != NULL); message = link->data; _dbus_verbose ("queueing received message %p\n", message); if (!_dbus_message_add_counter (message, transport->live_messages)) { _dbus_message_loader_putback_message_link (transport->loader, link); status = DBUS_DISPATCH_NEED_MEMORY; break; } else { /* pass ownership of link and message ref to connection */ _dbus_connection_queue_received_message_link (transport->connection, link); } } if (_dbus_message_loader_get_is_corrupted (transport->loader)) { _dbus_verbose ("Corrupted message stream, disconnecting\n"); _dbus_transport_disconnect (transport); } return status != DBUS_DISPATCH_NEED_MEMORY; }