Thread (26 messages) 26 messages, 2 authors, 2017-11-09
STALE3136d

[PATCH 11/23] adapter: Do not poll when there is an active tag

From: Mark Greer <mgreer@animalcreek.com>
Date: 2017-06-15 18:25:31
Subsystem: the rest · Maintainer: Linus Torvalds

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>
---
 src/adapter.c | 3 +++
 1 file changed, 3 insertions(+)
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);
 
-- 
2.13.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help