aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-10-10 10:26:08 +0000
committerBart Polot <bart@net.in.tum.de>2012-10-10 10:26:08 +0000
commita0e539e0e1911c2e68df06594624c3f53d569870 (patch)
tree323d33b68f12536ad9145519263601f4b62ef13e /src
parent79e6c27371e642717aa5d175b70900fd9c14d71f (diff)
downloadgnunet-a0e539e0e1911c2e68df06594624c3f53d569870.tar.gz
gnunet-a0e539e0e1911c2e68df06594624c3f53d569870.zip
- fix crashes on backwards tests, doxygen, cleanup
Diffstat (limited to 'src')
-rw-r--r--src/mesh/test_mesh_small.c56
1 files changed, 41 insertions, 15 deletions
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c
index 85e507338..8dfcd9457 100644
--- a/src/mesh/test_mesh_small.c
+++ b/src/mesh/test_mesh_small.c
@@ -186,6 +186,9 @@ static GNUNET_SCHEDULER_TaskIdentifier test_task;
186 */ 186 */
187static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; 187static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
188 188
189/**
190 * Filename of the file containing the topology.
191 */
189static char *topology_file; 192static char *topology_file;
190 193
191/** 194/**
@@ -233,12 +236,16 @@ static struct GNUNET_MESH_Tunnel *incoming_t;
233 */ 236 */
234static struct GNUNET_MESH_Tunnel *incoming_t2; 237static struct GNUNET_MESH_Tunnel *incoming_t2;
235 238
236static GNUNET_PEER_Id pid1; 239/**
237 240 * Time we started the data transmission (after tunnel has been established
241 * and initilized).
242 */
238static struct GNUNET_TIME_Absolute start_time; 243static struct GNUNET_TIME_Absolute start_time;
239 244
240 245
241 246/**
247 * Show the results of the test (banwidth acheived) and log them to GAUGER
248 */
242static void 249static void
243show_end_data (void) 250show_end_data (void)
244{ 251{
@@ -262,6 +269,9 @@ show_end_data (void)
262 269
263/** 270/**
264 * Check whether peers successfully shut down. 271 * Check whether peers successfully shut down.
272 *
273 * @param cls Closure (unused).
274 * @param emsg Error message.
265 */ 275 */
266static void 276static void
267shutdown_callback (void *cls, const char *emsg) 277shutdown_callback (void *cls, const char *emsg)
@@ -287,6 +297,9 @@ shutdown_callback (void *cls, const char *emsg)
287 297
288/** 298/**
289 * Shut down peergroup, clean up. 299 * Shut down peergroup, clean up.
300 *
301 * @param cls Closure (unused).
302 * @param tc Task Context.
290 */ 303 */
291static void 304static void
292shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 305shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -326,6 +339,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
326 339
327/** 340/**
328 * Disconnect from mesh services af all peers, call shutdown. 341 * Disconnect from mesh services af all peers, call shutdown.
342 *
343 * @param cls Closure (unused).
344 * @param tc Task Context.
329 */ 345 */
330static void 346static void
331disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 347disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -363,9 +379,26 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
363 } 379 }
364} 380}
365 381
382
383/**
384 * Transmit ready callback.
385 *
386 * @param cls Closure (peer #).
387 * @param size Size of the tranmist buffer.
388 * @param buf Pointer to the beginning of the buffer.
389 *
390 * @return Number of bytes written to buf.
391 */
366static size_t 392static size_t
367tmt_rdy (void *cls, size_t size, void *buf); 393tmt_rdy (void *cls, size_t size, void *buf);
368 394
395
396/**
397 * Task to schedule a new data transmission.
398 *
399 * @param cls Closure (peer #).
400 * @param tc Task Context.
401 */
369static void 402static void
370data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 403data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
371{ 404{
@@ -413,6 +446,7 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
413 } 446 }
414} 447}
415 448
449
416/** 450/**
417 * Transmit ready callback 451 * Transmit ready callback
418 * 452 *
@@ -434,7 +468,7 @@ tmt_rdy (void *cls, size_t size, void *buf)
434 if (test == SPEED) 468 if (test == SPEED)
435 { 469 {
436 data_sent++; 470 data_sent++;
437 if (data_sent < TOTAL_PACKETS) 471 if (data_sent < TOTAL_PACKETS && ok > 1)
438 { 472 {
439 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
440 " Scheduling %d packet\n", data_sent); 474 " Scheduling %d packet\n", data_sent);
@@ -695,16 +729,9 @@ ch (void *cls, const struct GNUNET_PeerIdentity *peer,
695 case UNICAST: 729 case UNICAST:
696 case SPEED: 730 case SPEED:
697 case SPEED_ACK: 731 case SPEED_ACK:
698 if (GNUNET_YES == test_backwards) 732 // incoming_t is NULL unless we send a relevant data packet
699 { 733 dest = &d2->id;
700 dest = &d1->id; 734 tunnel = t;
701 tunnel = incoming_t;
702 }
703 else
704 {
705 dest = &d2->id;
706 tunnel = t;
707 }
708 break; 735 break;
709 case MULTICAST: 736 case MULTICAST:
710 peers_in_tunnel++; 737 peers_in_tunnel++;
@@ -884,7 +911,6 @@ peergroup_ready (void *cls, const char *emsg)
884 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 911 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
885 "Peer looking: %s\n", 912 "Peer looking: %s\n",
886 GNUNET_i2s (&d1->id)); 913 GNUNET_i2s (&d1->id));
887 pid1 = GNUNET_PEER_intern (&d1->id);
888 914
889 GNUNET_SCHEDULER_add_now (&connect_mesh_service, NULL); 915 GNUNET_SCHEDULER_add_now (&connect_mesh_service, NULL);
890 disconnect_task = 916 disconnect_task =