dbus/bus connection.c, 1.53, 1.54 expirelist.c, 1.4, 1.5 expirelist.h, 1.4, 1.5

Kristian Hogsberg krh at pdx.freedesktop.org
Thu May 20 12:47:38 PDT 2004


Update of /cvs/dbus/dbus/bus
In directory pdx:/tmp/cvs-serv31154/bus

Modified Files:
	connection.c expirelist.c expirelist.h 
Log Message:
	* 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.


Index: connection.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/connection.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- a/connection.c	2 Dec 2003 10:44:21 -0000	1.53
+++ b/connection.c	20 May 2004 19:47:34 -0000	1.54
@@ -517,7 +517,6 @@
 
       _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 @@
   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 @@
   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 @@
       
       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)
     {

Index: expirelist.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/expirelist.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/expirelist.c	2 Dec 2003 10:44:21 -0000	1.4
+++ b/expirelist.c	20 May 2004 19:47:35 -0000	1.5
@@ -81,7 +81,6 @@
 void
 bus_expire_list_free (BusExpireList *list)
 {
-  _dbus_assert (list->n_items == 0);
   _dbus_assert (list->items == NULL);
 
   _dbus_loop_remove_timeout (list->loop, list->timeout,

Index: expirelist.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/expirelist.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/expirelist.h	2 Dec 2003 10:44:21 -0000	1.4
+++ b/expirelist.h	20 May 2004 19:47:35 -0000	1.5
@@ -38,7 +38,6 @@
 struct BusExpireList
 {
   DBusList      *items; /**< List of BusExpireItem */
-  int            n_items;
   DBusTimeout   *timeout;
   DBusLoop      *loop;
   BusExpireFunc  expire_func;




More information about the dbus-commit mailing list