*/
static struct GNUNET_TESTBED_Peer *peers[NUM_PEERS];
+/**
+ * Operation handle
+ */
+static struct GNUNET_TESTBED_Operation *op;
+
/**
* Abort task identifier
*/
master_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
result = GNUNET_OK;
- /* Artificial delay */
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL);
+ GNUNET_assert (NULL != peers[0]);
+ op = GNUNET_TESTBED_peer_stop (peers[0]);
+ GNUNET_assert (NULL != op);
}
GNUNET_assert (NULL != event->details.peer_start.peer);
peers[peer_id++] = event->details.peer_start.peer;
break;
+ case GNUNET_TESTBED_ET_PEER_STOP:
+ GNUNET_assert (NULL != op);
+ GNUNET_TESTBED_operation_done (op);
+ GNUNET_assert (peers[0] == event->details.peer_stop.peer);
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ break;
default:
GNUNET_assert (0);
}
#include "platform.h"
#include "gnunet_testbed_service.h"
+#include "testbed_api_peers.h"
/**
* Generic loggins shorthand
rc->peer_count = 0;
for (peer = 0; peer < rc->num_peers; peer++)
{
+ if (PS_STARTED != rc->peers[peer]->state)
+ {
+ rc->peer_count++;
+ continue;
+ }
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer]);
dll_op->cls = rc->peers[peer];
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
dll_op);
}
- return;
+ if (rc->peer_count != rc->num_peers)
+ return;
}
}
rc->state = RC_PEERS_DESTROYED; /* No peers are present so we consider the