File fix-timeout-reset.patch of Package dbus-1.5763
Index: dbus-1.8.16/bus/connection.c
===================================================================
--- dbus-1.8.16.orig/bus/connection.c
+++ dbus-1.8.16/bus/connection.c
@@ -620,7 +620,7 @@ check_pending_fds_cb (DBusConnection *co
{
_dbus_timeout_set_interval (d->pending_unix_fds_timeout,
bus_context_get_pending_fd_timeout (d->connections->context));
- _dbus_timeout_set_enabled (d->pending_unix_fds_timeout, TRUE);
+ _dbus_timeout_set_reenabled (d->pending_unix_fds_timeout, TRUE);
}
if (n_pending_unix_fds_old > 0 && n_pending_unix_fds_new == 0)
Index: dbus-1.8.16/dbus/dbus-connection.h
===================================================================
--- dbus-1.8.16.orig/dbus/dbus-connection.h
+++ dbus-1.8.16/dbus/dbus-connection.h
@@ -488,6 +488,10 @@ DBUS_EXPORT
dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
DBUS_EXPORT
dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
+DBUS_EXPORT
+dbus_bool_t dbus_timeout_needs_restart(DBusTimeout *timeout);
+DBUS_EXPORT
+void dbus_timeout_restarted (DBusTimeout *timeout);
/** @} */
Index: dbus-1.8.16/dbus/dbus-mainloop.c
===================================================================
--- dbus-1.8.16.orig/dbus/dbus-mainloop.c
+++ dbus-1.8.16/dbus/dbus-mainloop.c
@@ -608,6 +608,14 @@ _dbus_loop_iterate (DBusLoop *loop,
if (dbus_timeout_get_enabled (tcb->timeout))
{
+ if (dbus_timeout_needs_restart (tcb->timeout))
+ {
+ tcb->last_tv_sec = tv_sec;
+ tcb->last_tv_usec = tv_usec;
+ dbus_timeout_restarted (tcb->timeout);
+ }
+
+
int msecs_remaining;
check_timeout (tv_sec, tv_usec, tcb, &msecs_remaining);
Index: dbus-1.8.16/dbus/dbus-timeout.c
===================================================================
--- dbus-1.8.16.orig/dbus/dbus-timeout.c
+++ dbus-1.8.16/dbus/dbus-timeout.c
@@ -49,6 +49,7 @@ struct DBusTimeout
void *data; /**< Application data. */
DBusFreeFunction free_data_function; /**< Free the application data. */
unsigned int enabled : 1; /**< True if timeout is active. */
+ unsigned int needs_restart : 1; /**< Flag that timeout should be restarted after re-enabling. */
};
/**
@@ -79,6 +80,7 @@ _dbus_timeout_new (int i
timeout->free_handler_data_function = free_data_function;
timeout->enabled = TRUE;
+ timeout->needs_restart = FALSE;
return timeout;
}
@@ -156,6 +158,16 @@ _dbus_timeout_set_enabled (DBusTimeout
timeout->enabled = enabled != FALSE;
}
+void
+_dbus_timeout_set_reenabled (DBusTimeout *timeout,
+ dbus_bool_t enabled)
+{
+ timeout->enabled = enabled != FALSE;
+ if (timeout->enabled) {
+ timeout->needs_restart = TRUE;
+ }
+}
+
/**
* @typedef DBusTimeoutList
@@ -488,4 +500,17 @@ dbus_timeout_get_enabled (DBusTimeout *t
return timeout->enabled;
}
+dbus_bool_t
+dbus_timeout_needs_restart (DBusTimeout *timeout)
+{
+ return timeout->needs_restart;
+}
+
+void
+dbus_timeout_restarted (DBusTimeout *timeout)
+{
+ timeout->needs_restart = FALSE;
+}
+
+
/** @} end public API docs */
Index: dbus-1.8.16/dbus/dbus-timeout.h
===================================================================
--- dbus-1.8.16.orig/dbus/dbus-timeout.h
+++ dbus-1.8.16/dbus/dbus-timeout.h
@@ -50,6 +50,8 @@ void _dbus_timeout_set_interval
int interval);
void _dbus_timeout_set_enabled (DBusTimeout *timeout,
dbus_bool_t enabled);
+void _dbus_timeout_set_reenabled(DBusTimeout *timeout,
+ dbus_bool_t enabled);
DBusTimeoutList *_dbus_timeout_list_new (void);
void _dbus_timeout_list_free (DBusTimeoutList *timeout_list);