diff options
-rw-r--r-- | doc/manager-api.txt | 5 | ||||
-rw-r--r-- | src/counter.c | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 35477dc3..1ba0480c 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 ae165e4e..d897fb59 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, |