summaryrefslogtreecommitdiffstats
path: root/bus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-10-11 06:20:28 +0000
committerHavoc Pennington <hp@redhat.com>2003-10-11 06:20:28 +0000
commit40751c847b18b4861f623fc83fc8742bc463363b (patch)
treef4875210529f3f957841f234f3316bc614c9fcba /bus
parentc1f0e189030ceb2bafea0bc30d6b72a0fa381ddc (diff)
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)
Diffstat (limited to 'bus')
-rw-r--r--bus/Makefile.am2
-rw-r--r--bus/connection.c26
-rw-r--r--bus/test-main.c6
-rw-r--r--bus/test.h1
4 files changed, 15 insertions, 20 deletions
diff --git a/bus/Makefile.am b/bus/Makefile.am
index bc728801..a6c4b17b 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -40,6 +40,8 @@ BUS_SOURCES= \
dispatch.h \
driver.c \
driver.h \
+ expirelist.c \
+ expirelist.h \
policy.c \
policy.h \
services.c \
diff --git a/bus/connection.c b/bus/connection.c
index a824576c..68e4158a 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -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 @@ bus_connections_expire_incomplete (BusConnections *connections)
_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 @@ bus_connections_expire_incomplete (BusConnections *connections)
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
diff --git a/bus/test-main.c b/bus/test-main.c
index 3f280d4e..31a9e158 100644
--- a/bus/test-main.c
+++ b/bus/test-main.c
@@ -76,6 +76,12 @@ main (int argc, char **argv)
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))
diff --git a/bus/test.h b/bus/test.h
index fc972fe3..585f1c8e 100644
--- a/bus/test.h
+++ b/bus/test.h
@@ -37,6 +37,7 @@ dbus_bool_t bus_dispatch_sha1_test (const DBusString *test_data_d
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);