- fix compile
authorSree Harsha Totakura <totakura@in.tum.de>
Mon, 9 Sep 2013 14:52:57 +0000 (14:52 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Mon, 9 Sep 2013 14:52:57 +0000 (14:52 +0000)
src/testbed/gnunet-service-testbed_barriers.c
src/testbed/test_testbed_api_barriers.h [new file with mode: 0644]

index 693396ef6e42170b30b406cc150f391f74ec68a1..663c090b6326f6b911875de4cf911cde2950ad77 100644 (file)
@@ -168,7 +168,7 @@ struct Barrier
   /**
    * The client handle to the master controller
    */
-  struct GNUNET_SERVER_Client *client;
+  struct GNUNET_SERVER_Client *mc;
 
   /**
    * The name of the barrier
@@ -308,6 +308,8 @@ queue_message (struct ClientCtx *ctx, struct GNUNET_MessageHeader *msg)
   
   mq = GNUNET_malloc (sizeof (struct MessageQueue));
   mq->msg = msg;
+  LOG_DEBUG ("Queueing message of type %u, size %u for sending\n",
+             ntohs (msg->type), ntohs (msg->size));
   GNUNET_CONTAINER_DLL_insert_tail (ctx->mq_head, ctx->mq_tail, mq);
   if (NULL == ctx->tx)
    ctx->tx = GNUNET_SERVER_notify_transmit_ready (client, ntohs (msg->size),
@@ -359,7 +361,7 @@ remove_barrier (struct Barrier *barrier)
     cleanup_clientctx (ctx);
   }
   GNUNET_free (barrier->name);
-  GNUNET_SERVER_client_drop (barrier->client);
+  GNUNET_SERVER_client_drop (barrier->mc);
   GNUNET_free (barrier);
 }
 
@@ -430,8 +432,7 @@ static void
 send_barrier_status_msg (struct Barrier *barrier, const char *emsg)
 {
   GNUNET_assert (0 != barrier->status);
-  send_client_status_msg (barrier->client, barrier->name,
-                          barrier->status, emsg);
+  send_client_status_msg (barrier->mc, barrier->name, barrier->status, emsg);
 }
 
 
@@ -529,6 +530,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client,
     GNUNET_SERVER_client_keep (client);
     client_ctx->barrier = barrier;
     GNUNET_CONTAINER_DLL_insert_tail (barrier->head, barrier->tail, client_ctx);
+    GNUNET_SERVER_client_set_user_context (client, client_ctx); 
   }
   barrier->nreached++;
   if ((barrier->num_wbarriers_reached == barrier->num_wbarriers)
@@ -754,7 +756,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
   (void) memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
   barrier->quorum = msg->quorum;
   barrier->name = name;
-  barrier->client = client;
+  barrier->mc = client;
   GNUNET_SERVER_client_keep (client);
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONTAINER_multihashmap_put (barrier_map,
diff --git a/src/testbed/test_testbed_api_barriers.h b/src/testbed/test_testbed_api_barriers.h
new file mode 100644 (file)
index 0000000..dbcdbd8
--- /dev/null
@@ -0,0 +1,5 @@
+
+/**
+ * The name to use for the barrier in the test cases
+ */
+#define TEST_BARRIER_NAME "test_barrier"