summaryrefslogtreecommitdiff
path: root/bus/expirelist.c
diff options
context:
space:
mode:
authorMichal Koutný <mkoutny@suse.com>2016-05-24 11:14:11 +0200
committerSimon McVittie <smcv@debian.org>2017-02-01 10:42:50 +0000
commit529600397bcab47b9bed5da9208c2df05c8b86b4 (patch)
tree17e9af27f973a4e0132ee23e405ed7d52fdb0771 /bus/expirelist.c
parentbefd186c0b005f1e1130cb3e4923c689085a8dbc (diff)
downloaddbus-529600397bcab47b9bed5da9208c2df05c8b86b4.tar.gz
bus: Fix timeout restarts
The code counting pending fds relied on restart of timeouts when they are enabled. This patch adds function that ensures that such enabled timeouts have their timekeeping data reset (and not only when timeout is registered into event loop processing). When timeouts weren't reset, they'd fire at rather random and mainly incorrect moments leading to interruption of connections of dbus-daemon. Every time we reset the interval, we also need to re-enable the timeout and mark its end time to be recalculated by the event loop, so combine the old set_enabled(TRUE) with set_interval() as a new restart() method. This leaves all the set_enabled() calls having a FALSE parameter, so remove the parameter and rename the method to disable(). [smcv: fix minor coding style issues] [smcv: replace set_reenabled()/set_interval() pair with restart()] [smcv: replace set_enabled(FALSE) with disable()] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95619 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'bus/expirelist.c')
-rw-r--r--bus/expirelist.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/bus/expirelist.c b/bus/expirelist.c
index 9a3886e9..4a397527 100644
--- a/bus/expirelist.c
+++ b/bus/expirelist.c
@@ -63,7 +63,7 @@ bus_expire_list_new (DBusLoop *loop,
if (list->timeout == NULL)
goto failed;
- _dbus_timeout_set_enabled (list->timeout, FALSE);
+ _dbus_timeout_disable (list->timeout);
if (!_dbus_loop_add_timeout (list->loop, list->timeout))
goto failed;
@@ -97,16 +97,14 @@ bus_expire_timeout_set_interval (DBusTimeout *timeout,
{
if (next_interval >= 0)
{
- _dbus_timeout_set_interval (timeout,
- next_interval);
- _dbus_timeout_set_enabled (timeout, TRUE);
+ _dbus_timeout_restart (timeout, next_interval);
_dbus_verbose ("Enabled an expire timeout with interval %d\n",
next_interval);
}
else if (dbus_timeout_get_enabled (timeout))
{
- _dbus_timeout_set_enabled (timeout, FALSE);
+ _dbus_timeout_disable (timeout);
_dbus_verbose ("Disabled an expire timeout\n");
}