gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17263 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r17263 - gnunet/src/mesh
Date: Thu, 6 Oct 2011 20:22:49 +0200

Author: bartpolot
Date: 2011-10-06 20:22:49 +0200 (Thu, 06 Oct 2011)
New Revision: 17263

Modified:
   gnunet/src/mesh/test_mesh_small.conf
   gnunet/src/mesh/test_mesh_small_unicast.c
Log:
WiP

Modified: gnunet/src/mesh/test_mesh_small.conf
===================================================================
--- gnunet/src/mesh/test_mesh_small.conf        2011-10-06 17:38:50 UTC (rev 
17262)
+++ gnunet/src/mesh/test_mesh_small.conf        2011-10-06 18:22:49 UTC (rev 
17263)
@@ -19,6 +19,9 @@
 HOSTNAME = localhost
 PORT = 10001
 
+[nse]
+WORKBITS = 0
+
 [dns]
 AUTOSTART = NO
 PORT = 10011

Modified: gnunet/src/mesh/test_mesh_small_unicast.c
===================================================================
--- gnunet/src/mesh/test_mesh_small_unicast.c   2011-10-06 17:38:50 UTC (rev 
17262)
+++ gnunet/src/mesh/test_mesh_small_unicast.c   2011-10-06 18:22:49 UTC (rev 
17263)
@@ -124,6 +124,8 @@
 
 static struct GNUNET_TESTING_Daemon *d1;
 
+static GNUNET_PEER_Id pid1;
+
 static struct GNUNET_TESTING_Daemon *d2;
 
 static struct GNUNET_MESH_Handle *h1;
@@ -132,7 +134,7 @@
 
 static struct GNUNET_MESH_Tunnel *t;
 
-static uint16_t mesh_peers[16];
+static uint16_t *mesh_peers;
 
 /**
  * Check whether peers successfully shut down.
@@ -312,11 +314,11 @@
 
   GNUNET_PEER_resolve(1, &id);
   p1 = GNUNET_PEER_search(first);
-  if (p1 == 1)
+  if (p1 == pid1)
   {
     p2 = GNUNET_PEER_search(second);
     GNUNET_assert(p2 < num_peers);
-    if (0 == p2) return;
+    GNUNET_assert(p2 > 0);
     mesh_peers[p2]++;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "test: %s IS a neighbor\n",
@@ -324,11 +326,11 @@
     return;
   }
   p1 = GNUNET_PEER_search(second);
-  if (p1 == 1)
+  if (p1 == pid1)
   {
     p2 = GNUNET_PEER_search(first);
     GNUNET_assert(p2 < num_peers);
-    if (0 == p2) return;
+    GNUNET_assert(p2 > 0);
     mesh_peers[p2]++;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "test: %s IS a neighbor\n",
@@ -346,14 +348,25 @@
 {
   GNUNET_MESH_ApplicationType app;
   unsigned int i;
+  struct GNUNET_PeerIdentity id;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: connect_mesh_service\n");
 
-  for (i = 1; i < num_peers; i++)
+  for (i = 1; i <= num_peers; i++)
+  {
+    GNUNET_PEER_resolve(i, &id);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "test:   peer %s has %u conns to d1\n",
+              GNUNET_i2s (&id),
+              mesh_peers[i]);
     if (mesh_peers[i] == 0)
       break;
+  }
   GNUNET_assert (i < num_peers);
-  d2 = GNUNET_TESTING_daemon_get (pg, i);
+  d2 = GNUNET_TESTING_daemon_get_by_id (pg, &id);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "test: Peer searched: %s\n",
+              GNUNET_i2s (&d2->id));
   app = (GNUNET_MESH_ApplicationType) 0;
 
 #if VERBOSE
@@ -445,8 +458,13 @@
                 "test:   %u: %s\n",
                 GNUNET_PEER_intern(&d1->id),
                 GNUNET_i2s (&d1->id));
-    mesh_peers[i] = 0;
   }
+  d1 = GNUNET_TESTING_daemon_get (pg, 0);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "test: Peer looking: %s\n",
+              GNUNET_i2s (&d1->id));
+  pid1 = GNUNET_PEER_intern(&d1->id);
+  mesh_peers[pid1] = 100;
   GNUNET_TESTING_get_topology(pg, &topo_cb, NULL);
 
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(
@@ -482,23 +500,9 @@
             struct GNUNET_TESTING_Daemon *first_daemon,
             struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
 {
-//   GNUNET_PEER_Id f;
-//   GNUNET_PEER_Id s;
-
   if (emsg == NULL)
   {
     total_connections++;
-    /*f = */GNUNET_PEER_intern(first);
-    /*s = */GNUNET_PEER_intern(second);
-//   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: New connection!\n");
-//   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-//               "test:     %s (%u)\n",
-//               GNUNET_h2s(&first->hashPubKey),
-//               f);
-//   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-//               "test:     %s (%u)\n",
-//               GNUNET_h2s(&second->hashPubKey),
-//               s);
   }
   else
   {
@@ -559,6 +563,8 @@
     }
   }
 
+  mesh_peers = GNUNET_malloc (sizeof(GNUNET_PEER_Id) * (num_peers + 1));
+
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (testing_cfg, "test_mesh_small",
                                              "wait_time", &temp_wait))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]