From: Marcel Holtmann Date: Tue, 5 Jan 2010 23:53:33 +0000 (-0800) Subject: Allow counters with zero interval X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~2897 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ded3e33a21945a95394dd092bfd34f145b8c6138;p=profile%2Fivi%2Fconnman.git Allow counters with zero interval --- diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 35477dc..1ba0480 100644 --- a/doc/manager-api.txt +++ b/doc/manager-api.txt @@ -109,6 +109,11 @@ Methods dict GetProperties() Register a new counter for user notifications. + If the interval is zero then no timer for updates + will be started. Only kernel events can then + trigger updates. Otherwise the kernel will be + polled every n seconds for an update. + Possible Errors: [service].Error.InvalidArguments void UnregisterCounter(object path) diff --git a/src/counter.c b/src/counter.c index ae165e4..d897fb5 100644 --- a/src/counter.c +++ b/src/counter.c @@ -99,9 +99,6 @@ int __connman_counter_register(const char *owner, const char *path, DBG("owner %s path %s interval %u", owner, path, interval); - if (interval < 1) - return -EINVAL; - counter = g_hash_table_lookup(counter_table, path); if (counter != NULL) return -EEXIST; @@ -116,7 +113,8 @@ int __connman_counter_register(const char *owner, const char *path, g_hash_table_replace(counter_table, counter->path, counter); g_hash_table_replace(owner_mapping, counter->owner, counter); - counter->timeout = g_timeout_add_seconds(interval, + if (interval > 0) + counter->timeout = g_timeout_add_seconds(interval, counter_timeout, counter); counter->watch = g_dbus_add_disconnect_watch(connection, owner,