diff options
author | Frédéric Danis <frederic.danis@collabora.com> | 2021-03-16 18:18:36 +0100 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-03-16 10:56:36 -0700 |
commit | 389bcb2b78a9a1502d70154bbf45bd93c2fec853 (patch) | |
tree | b6d439574b3154992dfe25130ea02997e4ddabb5 /profiles/sap | |
parent | 7b18419775a14fa08f42280eb7ce061849fc0c70 (diff) | |
download | bluez-389bcb2b78a9a1502d70154bbf45bd93c2fec853.tar.gz |
profiles: Use timeout_add_seconds
Replace calls to g_timeout_add_seconds() by the timeout_add_seconds()
wrapper which takes care of 0 delay.
Diffstat (limited to 'profiles/sap')
-rw-r--r-- | profiles/sap/server.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/profiles/sap/server.c b/profiles/sap/server.c index b0a454ced..82365fca9 100644 --- a/profiles/sap/server.c +++ b/profiles/sap/server.c @@ -31,6 +31,7 @@ #include "src/log.h" #include "src/error.h" #include "src/dbus-common.h" +#include "src/shared/timeout.h" #include "src/shared/util.h" #include "sap.h" @@ -62,7 +63,7 @@ struct sap_connection { GIOChannel *io; uint32_t state; uint8_t processing_req; - guint timer_id; + unsigned int timer_id; }; struct sap_server { @@ -74,7 +75,7 @@ struct sap_server { static void start_guard_timer(struct sap_server *server, guint interval); static void stop_guard_timer(struct sap_server *server); -static gboolean guard_timeout(gpointer data); +static bool guard_timeout(gpointer data); static size_t add_result_parameter(uint8_t result, struct sap_parameter *param) @@ -554,8 +555,8 @@ static void start_guard_timer(struct sap_server *server, guint interval) return; if (!conn->timer_id) - conn->timer_id = g_timeout_add_seconds(interval, guard_timeout, - server); + conn->timer_id = timeout_add_seconds(interval, guard_timeout, + server, NULL); else error("Timer is already active."); } @@ -565,12 +566,12 @@ static void stop_guard_timer(struct sap_server *server) struct sap_connection *conn = server->conn; if (conn && conn->timer_id) { - g_source_remove(conn->timer_id); + timeout_remove(conn->timer_id); conn->timer_id = 0; } } -static gboolean guard_timeout(gpointer data) +static bool guard_timeout(gpointer data) { struct sap_server *server = data; struct sap_connection *conn = server->conn; |