summaryrefslogtreecommitdiffstats
path: root/bus/connection.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2004-05-20 19:47:36 +0000
committerKristian Høgsberg <krh@redhat.com>2004-05-20 19:47:36 +0000
commitdf23f08f9b4607660aeee2c3640b80e1b6aad256 (patch)
tree8988c275061a549279dd778dabf1a642a5f4283d /bus/connection.c
parent1919d92d850f247d70cb6821724c4908bf70eeda (diff)
* doc/TODO: Remove resolved items.
* bus/expirelist.h (struct BusExpireList): remove unused n_items field. * bus/connection.c (bus_connections_expect_reply): Enforce the per-connection limit on pending replies.
Diffstat (limited to 'bus/connection.c')
-rw-r--r--bus/connection.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bus/connection.c b/bus/connection.c
index 557401fd..6b4fbe73 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -517,7 +517,6 @@ bus_connections_unref (BusConnections *connections)
_dbus_assert (connections->n_completed == 0);
- _dbus_assert (connections->pending_replies->n_items == 0);
bus_expire_list_free (connections->pending_replies);
_dbus_loop_remove_timeout (bus_context_get_loop (connections->context),
@@ -1544,6 +1543,7 @@ bus_connections_expect_reply (BusConnections *connections,
dbus_uint32_t reply_serial;
DBusList *link;
CancelPendingReplyData *cprd;
+ int count;
_dbus_assert (will_get_reply != NULL);
_dbus_assert (will_send_reply != NULL);
@@ -1555,6 +1555,7 @@ bus_connections_expect_reply (BusConnections *connections,
reply_serial = dbus_message_get_serial (reply_to_this);
link = _dbus_list_get_first_link (&connections->pending_replies->items);
+ count = 0;
while (link != NULL)
{
pending = link->data;
@@ -1570,8 +1571,17 @@ bus_connections_expect_reply (BusConnections *connections,
link = _dbus_list_get_next_link (&connections->pending_replies->items,
link);
+ ++count;
}
+ if (count >=
+ bus_context_get_max_replies_per_connection (connections->context))
+ {
+ dbus_set_error (error, DBUS_ERROR_LIMITS_EXCEEDED,
+ "The maximum number of pending replies per connection has been reached");
+ return FALSE;
+ }
+
pending = dbus_new0 (BusPendingReply, 1);
if (pending == NULL)
{