dbus/bus Makefile.am,1.28,1.29 connection.c,1.44,1.45 test-main.c,1.13,1.14 test.h,1.11,1.12

Havoc Pennington hp@pdx.freedesktop.org
Fri, 10 Oct 2003 23:20:30 -0700


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

Modified Files:
	Makefile.am connection.c test-main.c test.h 
Log Message:
2003-10-11  Havoc Pennington  <hp@pobox.com>

	* dbus/dbus-message.c (_dbus_message_test): add more test
	coverage, but #if 0 for now since they uncover a bug 
	not fixed yet; I think in re_align_field_recurse()
	(re_align_field_recurse): add FIXME about broken assertion

	* dbus/dbus-sysdeps.c (_dbus_sysdeps_test): add more test coverage

	* bus/connection.c: share a couple code bits with expirelist.c

	* bus/expirelist.h, bus/expirelist.c: implement a generic
	expire-items-after-N-seconds facility, was going to share between
	expiring connections and replies, decided not to use for expiring
	connections for now.

	* bus/connection.c: add tracking of expected replies

	* COPYING: include AFL 2.0 (still need to change all the file headers)



Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/bus/Makefile.am,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- Makefile.am	30 Sep 2003 02:32:50 -0000	1.28
+++ Makefile.am	11 Oct 2003 06:20:28 -0000	1.29
@@ -40,6 +40,8 @@
 	dispatch.h				\
 	driver.c				\
 	driver.h				\
+	expirelist.c				\
+	expirelist.h				\
 	policy.c				\
 	policy.h				\
 	services.c				\

Index: connection.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/connection.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- connection.c	30 Sep 2003 02:32:50 -0000	1.44
+++ connection.c	11 Oct 2003 06:20:28 -0000	1.45
@@ -26,6 +26,7 @@
 #include "services.h"
 #include "utils.h"
 #include "signals.h"
+#include "expirelist.h"
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-timeout.h>
@@ -672,8 +673,9 @@
       
           _dbus_assert (d != NULL);
       
-          elapsed = ((double) tv_sec - (double) d->connection_tv_sec) * 1000.0 +
-            ((double) tv_usec - (double) d->connection_tv_usec) / 1000.0;
+          elapsed = ELAPSED_MILLISECONDS_SINCE (d->connection_tv_sec,
+                                                d->connection_tv_usec,
+                                                tv_sec, tv_usec);
 
           if (elapsed >= (double) auth_timeout)
             {
@@ -693,25 +695,9 @@
           link = next;
         }
     }
-  
-  if (next_interval >= 0)
-    {
-      _dbus_timeout_set_interval (connections->expire_timeout,
-                                  next_interval);
-      _dbus_timeout_set_enabled (connections->expire_timeout, TRUE);
-
-      _dbus_verbose ("Enabled incomplete connections timeout with interval %d, %d incomplete connections\n",
-                     next_interval, connections->n_incomplete);
-    }
-  else if (dbus_timeout_get_enabled (connections->expire_timeout))
-    {
-      _dbus_timeout_set_enabled (connections->expire_timeout, FALSE);
 
-      _dbus_verbose ("Disabled incomplete connections timeout, %d incomplete connections\n",
-                     connections->n_incomplete);
-    }
-  else
-    _dbus_verbose ("No need to disable incomplete connections timeout\n");
+  bus_expire_timeout_set_interval (connections->expire_timeout,
+                                   next_interval);
 }
 
 static dbus_bool_t

Index: test-main.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/test-main.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- test-main.c	30 Sep 2003 02:32:50 -0000	1.13
+++ test-main.c	11 Oct 2003 06:20:28 -0000	1.14
@@ -76,6 +76,12 @@
   if (!_dbus_threads_init_debug ())
     die ("initializing debug threads");
 #endif
+
+  printf ("%s: Running expire list test\n", argv[0]);
+  if (!bus_expire_list_test (&test_data_dir))
+    die ("expire list");
+  
+  check_memleaks (argv[0]);
   
   printf ("%s: Running config file parser test\n", argv[0]);
   if (!bus_config_parser_test (&test_data_dir))

Index: test.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/test.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test.h	30 Sep 2003 02:32:50 -0000	1.11
+++ test.h	11 Oct 2003 06:20:28 -0000	1.12
@@ -37,6 +37,7 @@
 dbus_bool_t bus_policy_test           (const DBusString             *test_data_dir);
 dbus_bool_t bus_config_parser_test    (const DBusString             *test_data_dir);
 dbus_bool_t bus_signals_test          (const DBusString             *test_data_dir);
+dbus_bool_t bus_expire_list_test      (const DBusString             *test_data_dir);
 dbus_bool_t bus_setup_debug_client    (DBusConnection               *connection);
 void        bus_test_clients_foreach  (BusConnectionForeachFunction  function,
                                        void                         *data);