aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-06 16:46:13 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-06 16:46:13 +0000
commit3647df0bbd6bd27866ee63e5b9020776e9a7ce01 (patch)
treec17b65538a05223a49583b381bde7f012d7189ce /src/mesh
parenta024e1fe61644a01d0c5a759c04c5deb754f80a9 (diff)
downloadgnunet-3647df0bbd6bd27866ee63e5b9020776e9a7ce01.tar.gz
gnunet-3647df0bbd6bd27866ee63e5b9020776e9a7ce01.zip
Revert 17260
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/test_mesh_small.conf4
-rw-r--r--src/mesh/test_mesh_small_unicast.c86
2 files changed, 6 insertions, 84 deletions
diff --git a/src/mesh/test_mesh_small.conf b/src/mesh/test_mesh_small.conf
index 580a36f88..98def94c0 100644
--- a/src/mesh/test_mesh_small.conf
+++ b/src/mesh/test_mesh_small.conf
@@ -49,10 +49,6 @@ PORT = 10004
49[mesh] 49[mesh]
50PORT = 10005 50PORT = 10005
51DEBUG=YES 51DEBUG=YES
52ACCEPT_FROM = 127.0.0.1;
53HOSTNAME = localhost
54# PREFIX = valgrind --leak-check=full
55# PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
56 52
57[testing] 53[testing]
58NUM_PEERS = 16 54NUM_PEERS = 16
diff --git a/src/mesh/test_mesh_small_unicast.c b/src/mesh/test_mesh_small_unicast.c
index 826ef49f3..92e5d078b 100644
--- a/src/mesh/test_mesh_small_unicast.c
+++ b/src/mesh/test_mesh_small_unicast.c
@@ -289,61 +289,6 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
289 289
290 290
291/** 291/**
292 * Prototype of a callback function indicating that two peers
293 * are currently connected.
294 *
295 * @param cls closure
296 * @param first peer id for first daemon
297 * @param second peer id for the second daemon
298 * @param distance distance between the connected peers
299 * @param emsg error message (NULL on success)
300 */
301void
302topo_cb (void *cls,
303 const struct GNUNET_PeerIdentity* first,
304 const struct GNUNET_PeerIdentity* second,
305 const char *emsg)
306{
307 GNUNET_PEER_Id p1;
308 GNUNET_PEER_Id p2;
309 uint16_t *connections = cls;
310 struct GNUNET_PeerIdentity id;
311
312 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
313 "test: :::::::::::::::::::::::::: %u\n",
314 connections[0]);
315 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ###################### %p\n", connections);
316 GNUNET_PEER_resolve(connections[0], &id);
317 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
318 "test: looking for %s...\n",
319 GNUNET_i2s(&id));
320 p1 = GNUNET_PEER_search(first);
321 if (p1 == connections[0])
322 {
323 p2 = GNUNET_PEER_search(second);
324 GNUNET_assert(p2 < num_peers);
325 if (0 == p2) return;
326 connections[p2]++;
327 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
328 "test: %s IS a neighbor\n",
329 GNUNET_i2s(second));
330 return;
331 }
332 p1 = GNUNET_PEER_search(second);
333 if (p1 == connections[0])
334 {
335 p2 = GNUNET_PEER_search(first);
336 GNUNET_assert(p2 < num_peers);
337 if (0 == p2) return;
338 connections[p2]++;
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
340 "test: %s IS a neighbor\n",
341 GNUNET_i2s(first));
342 return;
343 }
344}
345
346/**
347 * connect_mesh_service: connect to the mesh service of one of the peers 292 * connect_mesh_service: connect to the mesh service of one of the peers
348 * 293 *
349 */ 294 */
@@ -351,39 +296,20 @@ static void
351connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 296connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
352{ 297{
353 GNUNET_MESH_ApplicationType app; 298 GNUNET_MESH_ApplicationType app;
354 uint16_t connections[num_peers];
355 uint16_t i;
356 299
357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: connect_mesh_service\n"); 300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: connect_mesh_service\n");
358 301
359 for (i = 0; i < num_peers; i++) 302 d1 = GNUNET_TESTING_daemon_get (pg, 1);
360 { 303 d2 = GNUNET_TESTING_daemon_get (pg, 3);
361 d1 = GNUNET_TESTING_daemon_get (pg, i);
362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
363 "test: %u: %s\n",
364 GNUNET_PEER_intern(&d1->id),
365 GNUNET_i2s (&d1->id));
366 connections[i] = 0;
367 }
368 connections[0] = GNUNET_PEER_intern(&d1->id);
369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ###################### %p\n", connections);
370 GNUNET_TESTING_get_topology(pg, &topo_cb, connections);
371 for (i = 1; i < num_peers; i++)
372 if (connections[i] == 0)
373 break;
374 GNUNET_assert (i < num_peers);
375 d2 = GNUNET_TESTING_daemon_get (pg, i);
376 app = (GNUNET_MESH_ApplicationType) 0; 304 app = (GNUNET_MESH_ApplicationType) 0;
377 305
378#if VERBOSE 306#if VERBOSE
379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
380 "test: connecting to mesh service of peer %s (%u)\n", 308 "test: connecting to mesh service of peer %s\n",
381 GNUNET_i2s (&d1->id), 309 GNUNET_i2s (&d1->id));
382 connections[0]);
383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 310 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
384 "test: connecting to mesh service of peer %s (%u)\n", 311 "test: connecting to mesh service of peer %s\n",
385 GNUNET_i2s (&d2->id), 312 GNUNET_i2s (&d2->id));
386 i);
387#endif 313#endif
388 h1 = GNUNET_MESH_connect (d1->cfg, 314 h1 = GNUNET_MESH_connect (d1->cfg,
389 10, 315 10,