* doc/TODO: Remove resolved items.
authorKristian Høgsberg <krh@redhat.com>
Thu, 20 May 2004 19:47:36 +0000 (19:47 +0000)
committerKristian Høgsberg <krh@redhat.com>
Thu, 20 May 2004 19:47:36 +0000 (19:47 +0000)
* 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.

ChangeLog
bus/connection.c
bus/expirelist.c
bus/expirelist.h
doc/TODO

index 8731eb8..c8b5858 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-05-20  Kristian Høgsberg  <krh@redhat.com>
 
+       * 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.
+       
        Patch from Jon Trowbridge <trow@ximian.com>:
  
        * bus/main.c (setup_reload_pipe): Added.  Creates a pipe and sets
index 557401f..6b4fbe7 100644 (file)
@@ -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)
     {
index ea2760a..f1485dc 100644 (file)
@@ -81,7 +81,6 @@ bus_expire_list_new (DBusLoop      *loop,
 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 c91964e..9baa36d 100644 (file)
@@ -38,7 +38,6 @@ typedef dbus_bool_t (* BusExpireFunc) (BusExpireList *list,
 struct BusExpireList
 {
   DBusList      *items; /**< List of BusExpireItem */
-  int            n_items;
   DBusTimeout   *timeout;
   DBusLoop      *loop;
   BusExpireFunc  expire_func;
index 15315b8..799f5b7 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
  - re_align_field_recurse() in dbus-message.c is broken because it 
    crashes on some types of header field values. security problem.
 
- - the system daemon has to be able to reload changes to the 
-   security policy without restarting, because apps won't 
-   be coded to handle it restarting
-
  - modify the wire protocol to keep the args signature separate 
    from the args themselves. Make the name of TYPE_CUSTOM part 
    of the type signature, rather than part of the value.
    yourself; is it an error, or allowed? If allowed, 
    we need to have a test for it in the test suite.
 
- - the max_replies_per_connection resource limit isn't implemented
-
  - array lengths should probably be returned as size_t rather than int
    (though they are kind of a pita to pass in as size_t with the 
     varargs, so maybe not - what does glib do with g_object_get()?)
 
  - recursive dispatch, see dbus_connection_dispatch()
 
- - Better error checking for bogus configuration files. Currently if a 
-   configuration file tries to include itself the bus crashes on start. We 
-   should probably have a check against this.
-
  - Perhaps the auth protocol should be able to negotiate a protocol 
    version to the least-common-denominator between client and server?
    Though in practice ever using this feature would be pretty tough,