removes restriction on the count of waiters
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 27 May 2016 21:07:19 +0000 (23:07 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 27 May 2016 21:07:19 +0000 (23:07 +0200)
in fact, using more than on web socket, the same client (same session)
can lock itself using wait and unlock itself using move...

Change-Id: I4ebd8fa93d3373589e9bb7fac7c250e29f94c460
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
plugins/samples/tic-tac-toe.c

index c372e99..31682d9 100644 (file)
@@ -549,7 +549,6 @@ static void play(struct afb_req req)
 
 static void wait(struct afb_req req)
 {
-       int count;
        struct board *board;
        struct waiter *waiter;
 
@@ -557,21 +556,6 @@ static void wait(struct afb_req req)
        board = board_of_req(req);
        INFO(afbitf, "method 'wait' called for boardid %d", board->id);
 
-       /* counts the waiters */
-       count = 0;
-       waiter = board->waiters;
-       while (waiter != NULL) {
-               count++;
-               waiter = waiter->next;
-       }
-
-       /* checks ability to wait */
-       if (count + 1 >= board->use_count) {
-               WARNING(afbitf, "can't wait: count=%d and use_count=%d", count, board->use_count);
-               afb_req_fail(req, "error", "can't wait");
-               return;
-       }
-
        /* creates the waiter and enqueues it */
        waiter = calloc(1, sizeof *waiter);
        waiter->req = req;