aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Greer <mgreer@animalcreek.com>2017-02-23 18:28:40 +0000
committerSamuel Ortiz <sameo@linux.intel.com>2017-11-10 00:23:57 +0100
commitb161b6b6e01415bdf13ac472a3854d49b605a4a6 (patch)
treeee117f129055caf5393070409c1b7b8f6a3c9b90
parent7a49d5c41477386b17fd992dabcb38c1648b6d50 (diff)
downloadneard-b161b6b6e01415bdf13ac472a3854d49b605a4a6.tar.gz
adapter: Do not poll when there is an active tag
When there is an active tag and a request to start polling is received by neard, it will discard the currently registered tag and requests that the kernel start another poll. The kernel receives this request and returns EBUSY because there is already an active tag. neard receives this failure and reports it to the poll requestor. At this point, the tag is active but neard no longer has any knowledge of it. Fix this by returning EBUSY when there is an active tag and a new poll request is received. Signed-off-by: Mark Greer <mgreer@animalcreek.com>
-rw-r--r--src/adapter.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c
index eb1a407..9e3e75e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -358,6 +358,9 @@ static DBusMessage *start_poll_loop(DBusConnection *conn,
return __near_error_failed(msg, ENODEV);
}
+ if (g_hash_table_size(adapter->tags) > 0)
+ return __near_error_failed(msg, EBUSY);
+
dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &dbus_mode,
DBUS_TYPE_INVALID);