[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26496 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26496 - gnunet/src/testbed |
Date: |
Tue, 19 Mar 2013 15:06:43 +0100 |
Author: harsha
Date: 2013-03-19 15:06:43 +0100 (Tue, 19 Mar 2013)
New Revision: 26496
Modified:
gnunet/src/testbed/test_testbed_api_statistics.conf
gnunet/src/testbed/testbed_api_statistics.c
Log:
- mark statistics service connect operations done when statistics iteration
completes
Modified: gnunet/src/testbed/test_testbed_api_statistics.conf
===================================================================
--- gnunet/src/testbed/test_testbed_api_statistics.conf 2013-03-19 14:06:10 UTC
(rev 26495)
+++ gnunet/src/testbed/test_testbed_api_statistics.conf 2013-03-19 14:06:43 UTC
(rev 26496)
@@ -5,6 +5,7 @@
HOSTNAME = localhost
NEIGHBOUR_LIMIT = 100
OVERLAY_TOPOLOGY = 2D_TORUS
+MAX_PARALLEL_SERVICE_CONNECTIONS = 2
#PREFIX = xterm -geometry 100x85 -T peer1 -e libtool --mode=execute gdb --args
[fs]
Modified: gnunet/src/testbed/testbed_api_statistics.c
===================================================================
--- gnunet/src/testbed/testbed_api_statistics.c 2013-03-19 14:06:10 UTC (rev
26495)
+++ gnunet/src/testbed/testbed_api_statistics.c 2013-03-19 14:06:43 UTC (rev
26496)
@@ -116,6 +116,11 @@
struct GNUNET_STATISTICS_GetHandle *get_handle;
/**
+ * Task to mark the statistics service connect operation as done
+ */
+ GNUNET_SCHEDULER_TaskIdentifier op_done_task_id;
+
+ /**
* The index of this peer in the peers array of GetStatsContext
*/
unsigned int peer_index;
@@ -150,6 +155,29 @@
/**
+ * Task to mark statistics service connect operation as done. We call it here
+ * as we cannot destroy the statistics handle in iteration_completion_cb()
+ *
+ * @param cls the PeerGetStatsContext
+ * @param tc the scheduler task context
+ */
+static void
+op_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct PeerGetStatsContext *peer_sc = cls;
+ struct GetStatsContext *sc;
+ struct GNUNET_TESTBED_Operation **op;
+
+ sc = peer_sc->sc;
+ peer_sc->op_done_task_id = GNUNET_SCHEDULER_NO_TASK;
+ op = &sc->ops[peer_sc->peer_index];
+ GNUNET_assert (NULL != *op);
+ GNUNET_TESTBED_operation_done (*op);
+ *op = NULL;
+}
+
+
+/**
* Continuation called by the "get_all" and "get" functions.
*
* @param cls the PeerGetStatsContext
@@ -164,7 +192,8 @@
if (NULL == peer_sc->get_handle)
{
- /* We are being called after we cancelled the GetHandle */
+ /* We are being called synchronously in call to GNUNET_STATISTICS_destroy()
+ in statistics_da() after we cancelled the GetHandle */
GNUNET_assert (GNUNET_SYSERR == success);
return;
}
@@ -172,6 +201,7 @@
sc = peer_sc->sc;
peer_sc->get_handle = NULL;
sc->num_completed++;
+ peer_sc->op_done_task_id = GNUNET_SCHEDULER_add_now (&op_done_task, peer_sc);
if (sc->num_completed == sc->num_peers)
{
LOG_DEBUG ("Scheduling to call iteration completion callback\n");
@@ -279,6 +309,8 @@
}
GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) op_result,
GNUNET_NO);
+ if (GNUNET_SCHEDULER_NO_TASK != peer_sc->op_done_task_id)
+ GNUNET_SCHEDULER_cancel (peer_sc->op_done_task_id);
GNUNET_free (peer_sc);
}
@@ -333,7 +365,10 @@
for (peer = 0; peer < sc->num_peers; peer++)
{
if (NULL != sc->ops[peer])
+ {
GNUNET_TESTBED_operation_done (sc->ops[peer]);
+ sc->ops[peer] = NULL;
+ }
}
GNUNET_free (sc->ops);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26496 - gnunet/src/testbed,
gnunet <=