diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-10-10 10:26:08 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-10-10 10:26:08 +0000 |
commit | a0e539e0e1911c2e68df06594624c3f53d569870 (patch) | |
tree | 323d33b68f12536ad9145519263601f4b62ef13e /src | |
parent | 79e6c27371e642717aa5d175b70900fd9c14d71f (diff) | |
download | gnunet-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.c | 56 |
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 | */ |
187 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; | 187 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; |
188 | 188 | ||
189 | /** | ||
190 | * Filename of the file containing the topology. | ||
191 | */ | ||
189 | static char *topology_file; | 192 | static char *topology_file; |
190 | 193 | ||
191 | /** | 194 | /** |
@@ -233,12 +236,16 @@ static struct GNUNET_MESH_Tunnel *incoming_t; | |||
233 | */ | 236 | */ |
234 | static struct GNUNET_MESH_Tunnel *incoming_t2; | 237 | static struct GNUNET_MESH_Tunnel *incoming_t2; |
235 | 238 | ||
236 | static GNUNET_PEER_Id pid1; | 239 | /** |
237 | 240 | * Time we started the data transmission (after tunnel has been established | |
241 | * and initilized). | ||
242 | */ | ||
238 | static struct GNUNET_TIME_Absolute start_time; | 243 | static 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 | */ | ||
242 | static void | 249 | static void |
243 | show_end_data (void) | 250 | show_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 | */ |
266 | static void | 276 | static void |
267 | shutdown_callback (void *cls, const char *emsg) | 277 | shutdown_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 | */ |
291 | static void | 304 | static void |
292 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 305 | shutdown_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 | */ |
330 | static void | 346 | static void |
331 | disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 347 | disconnect_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 | */ | ||
366 | static size_t | 392 | static size_t |
367 | tmt_rdy (void *cls, size_t size, void *buf); | 393 | tmt_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 | */ | ||
369 | static void | 402 | static void |
370 | data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 403 | data_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 = |