[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32671 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32671 - gnunet/src/mesh |
Date: |
Mon, 17 Mar 2014 12:02:47 +0100 |
Author: bartpolot
Date: 2014-03-17 12:02:47 +0100 (Mon, 17 Mar 2014)
New Revision: 32671
Modified:
gnunet/src/mesh/gnunet-mesh-profiler.c
Log:
- only ping from select peers, do not shut them down
Modified: gnunet/src/mesh/gnunet-mesh-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-mesh-profiler.c 2014-03-17 11:02:45 UTC (rev
32670)
+++ gnunet/src/mesh/gnunet-mesh-profiler.c 2014-03-17 11:02:47 UTC (rev
32671)
@@ -33,11 +33,17 @@
#define PONG 2
/**
- * How namy peers to run
+ * How many peers to run
*/
#define TOTAL_PEERS 10
/**
+ * How many peers do pinging
+ */
+#define PING_PEERS 1
+
+
+/**
* Duration of each round.
*/
#define ROUND_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
@@ -405,8 +411,10 @@
for (i = 0; i < delta; i++)
{
do {
- r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, TOTAL_PEERS);
- } while (peers[r].up == run);
+ r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ TOTAL_PEERS - PING_PEERS);
+ r += PING_PEERS;
+ } while (peers[r].up == run || NULL != peers[r].incoming);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "St%s peer %u: %s\n",
run ? "arting" : "opping", r, GNUNET_i2s (&peers[r].id));
@@ -416,10 +424,15 @@
peers[r].up = run;
- GNUNET_MESH_channel_destroy (peers[r].ch);
+ if (NULL != peers[r].ch)
+ GNUNET_MESH_channel_destroy (peers[r].ch);
peers[r].ch = NULL;
- GNUNET_MESH_channel_destroy (peers[r].dest->incoming_ch);
- peers[r].dest->incoming_ch = NULL;
+ if (NULL != peers[r].dest)
+ {
+ if (NULL != peers[r].dest->incoming_ch)
+ GNUNET_MESH_channel_destroy (peers[r].dest->incoming_ch);
+ peers[r].dest->incoming_ch = NULL;
+ }
GNUNET_MESH_disconnect (peers[r].mesh);
peers[r].mesh = NULL;
@@ -725,7 +738,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n");
flags = GNUNET_MESH_OPTION_DEFAULT;
- for (i = 0; i < TOTAL_PEERS; i++)
+ for (i = 0; i < PING_PEERS; i++)
{
peers[i].dest = select_random_peer (&peers[i]);
@@ -804,6 +817,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n");
ok = 0;
test_ctx = ctx;
+ GNUNET_assert (TOTAL_PEERS > 2 * PING_PEERS);
GNUNET_assert (TOTAL_PEERS == num_peers);
peers_running = num_peers;
testbed_handles = testbed_peers;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32671 - gnunet/src/mesh,
gnunet <=