diff options
author | Frédéric Danis <frederic.danis@collabora.com> | 2021-03-16 18:18:34 +0100 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-03-16 10:53:40 -0700 |
commit | c8f2dbad3928cf863a44be86e8d82b48c2d5850e (patch) | |
tree | 488de23b8aaf8b78e1947ccb65179a098e10cfdd /src/sdp-client.c | |
parent | efe0efc925db278ee61f93a1b59deaea8d442bba (diff) | |
download | bluez-c8f2dbad3928cf863a44be86e8d82b48c2d5850e.tar.gz |
core: 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 'src/sdp-client.c')
-rw-r--r-- | src/sdp-client.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/sdp-client.c b/src/sdp-client.c index 55f5bc323..71d3d9e95 100644 --- a/src/sdp-client.c +++ b/src/sdp-client.c @@ -21,6 +21,7 @@ #include "lib/sdp_lib.h" #include "btio/btio.h" +#include "shared/timeout.h" #include "log.h" #include "sdp-client.h" @@ -31,7 +32,7 @@ struct cached_sdp_session { bdaddr_t src; bdaddr_t dst; sdp_session_t *session; - guint timer; + unsigned int timer; guint io_id; }; @@ -44,7 +45,7 @@ static void cleanup_cached_session(struct cached_sdp_session *cached) g_free(cached); } -static gboolean cached_session_expired(gpointer user_data) +static bool cached_session_expired(gpointer user_data) { struct cached_sdp_session *cached = user_data; @@ -66,7 +67,7 @@ static sdp_session_t *get_cached_sdp_session(const bdaddr_t *src, if (bacmp(&c->src, src) || bacmp(&c->dst, dst)) continue; - g_source_remove(c->timer); + timeout_remove(c->timer); g_source_remove(c->io_id); session = c->session; @@ -85,7 +86,7 @@ static gboolean disconnect_watch(GIOChannel *chan, GIOCondition cond, { struct cached_sdp_session *cached = user_data; - g_source_remove(cached->timer); + timeout_remove(cached->timer); cleanup_cached_session(cached); return FALSE; @@ -107,9 +108,9 @@ static void cache_sdp_session(bdaddr_t *src, bdaddr_t *dst, cached_sdp_sessions = g_slist_append(cached_sdp_sessions, cached); - cached->timer = g_timeout_add_seconds(CACHE_TIMEOUT, + cached->timer = timeout_add_seconds(CACHE_TIMEOUT, cached_session_expired, - cached); + cached, NULL); /* Watch the connection state during cache timeout */ sk = sdp_get_socket(session); |