advertising: Timeout of 0 should not fire a callback
authorTroels Dalsgaard Hoffmeyer <troels.d.hoffmeyer@gmail.com>
Tue, 30 Apr 2019 11:51:47 +0000 (13:51 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
Setting a timeout of 0 on an advertisement should let the
advertisement run forever. The client was released
immediately after, although the advertisement was still in the air.

Change-Id: I4916bd36d3a12d5d35ab20c9d356e49e17af94fa
Signed-off-by: himanshu <h.himanshu@samsung.com>
src/advertising.c

index 89831bc..27cbad6 100644 (file)
@@ -582,8 +582,9 @@ static bool parse_timeout(DBusMessageIter *iter,
        if (client->to_id)
                g_source_remove(client->to_id);
 
-       client->to_id = g_timeout_add_seconds(client->timeout, client_timeout,
-                                                               client);
+       if (client->timeout > 0)
+               client->to_id = g_timeout_add_seconds(client->timeout,
+                                                       client_timeout, client);
 
        return true;
 }