diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-30 15:44:59 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-30 15:44:59 +0000 |
commit | e3c6e0bb694eac5c40941bc959cd8beecfe8cde9 (patch) | |
tree | 1931f9f09980046946a0cfd8fb9e8c9fd46bc2fe | |
parent | ba8a1ce1e673694a7bafb15d1fe70417bcf41a06 (diff) | |
download | gnunet-e3c6e0bb694eac5c40941bc959cd8beecfe8cde9.tar.gz gnunet-e3c6e0bb694eac5c40941bc959cd8beecfe8cde9.zip |
general intendation
some progress entertainment in transport/test_transport_api_disconnect.c
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 14 | ||||
-rw-r--r-- | src/transport/test_transport_api.c | 17 | ||||
-rw-r--r-- | src/transport/test_transport_api_disconnect.c | 7 | ||||
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 31 | ||||
-rw-r--r-- | src/transport/test_transport_api_unreliability.c | 41 |
5 files changed, 55 insertions, 55 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index ce2a98333..551d5550e 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -482,12 +482,12 @@ clients_handle_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
482 | 482 | ||
483 | tc = lookup_client (client); | 483 | tc = lookup_client (client); |
484 | if (NULL == tc) | 484 | if (NULL == tc) |
485 | { | 485 | { |
486 | /* client asked for transmission before 'START' */ | 486 | /* client asked for transmission before 'START' */ |
487 | GNUNET_break (0); | 487 | GNUNET_break (0); |
488 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 488 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
489 | return; | 489 | return; |
490 | } | 490 | } |
491 | 491 | ||
492 | size = ntohs (message->size); | 492 | size = ntohs (message->size); |
493 | if (size < | 493 | if (size < |
@@ -902,7 +902,7 @@ GST_clients_unicast (struct GNUNET_SERVER_Client *client, | |||
902 | 902 | ||
903 | tc = lookup_client (client); | 903 | tc = lookup_client (client); |
904 | if (NULL == tc) | 904 | if (NULL == tc) |
905 | return; /* client got disconnected in the meantime, drop message */ | 905 | return; /* client got disconnected in the meantime, drop message */ |
906 | unicast (tc, msg, may_drop); | 906 | unicast (tc, msg, may_drop); |
907 | } | 907 | } |
908 | 908 | ||
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 8f05d996d..365b833da 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -297,23 +297,20 @@ main (int argc, char *argv[]) | |||
297 | GNUNET_asprintf (&cfg_file_p2, "%s_peer2.conf", filename); | 297 | GNUNET_asprintf (&cfg_file_p2, "%s_peer2.conf", filename); |
298 | GNUNET_free (backup); | 298 | GNUNET_free (backup); |
299 | 299 | ||
300 | if ((strstr (argv[0], "tcp_nat") != NULL) || (strstr (argv[0], "udp_nat") != NULL)) | 300 | if ((strstr (argv[0], "tcp_nat") != NULL) || |
301 | (strstr (argv[0], "udp_nat") != NULL)) | ||
301 | { | 302 | { |
302 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); | 303 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); |
303 | if (GNUNET_NO == nat_res) | 304 | if (GNUNET_NO == nat_res) |
304 | { | 305 | { |
305 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 306 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
306 | "Cannot run NAT test: `%s' %s \n", | 307 | "gnunet-nat-server", "SUID not set"); |
307 | "gnunet-nat-server", | ||
308 | "SUID not set"); | ||
309 | return 0; | 308 | return 0; |
310 | } | 309 | } |
311 | if (GNUNET_SYSERR == nat_res) | 310 | if (GNUNET_SYSERR == nat_res) |
312 | { | 311 | { |
313 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 312 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
314 | "Cannot run NAT test: `%s' %s \n", | 313 | "gnunet-nat-server", "file not found"); |
315 | "gnunet-nat-server", | ||
316 | "file not found"); | ||
317 | return 0; | 314 | return 0; |
318 | } | 315 | } |
319 | 316 | ||
diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index a9cf0b4de..540d3b729 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c | |||
@@ -326,9 +326,16 @@ peers_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
326 | while (peers_connected > 0) ; | 326 | while (peers_connected > 0) ; |
327 | 327 | ||
328 | if (counter < ITERATIONS) | 328 | if (counter < ITERATIONS) |
329 | { | ||
330 | if ((counter % (ITERATIONS / 10)) == 0) | ||
331 | fprintf (stderr, "%u%%..", (counter / (ITERATIONS / 10)) * 10); | ||
329 | peers_connect (); | 332 | peers_connect (); |
333 | } | ||
330 | else | 334 | else |
335 | { | ||
336 | fprintf (stderr, "100%%\n"); | ||
331 | end (); | 337 | end (); |
338 | } | ||
332 | } | 339 | } |
333 | 340 | ||
334 | static void | 341 | static void |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 4cacf9c11..8f48008a6 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -118,9 +118,10 @@ end () | |||
118 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 118 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; |
119 | fprintf (stderr, "\nThroughput was %llu kb/s\n", | 119 | fprintf (stderr, "\nThroughput was %llu kb/s\n", |
120 | total_bytes * 1000 / 1024 / delta); | 120 | total_bytes * 1000 / 1024 / delta); |
121 | GNUNET_asprintf(&value_name, "reliable_%s", test_name); | 121 | GNUNET_asprintf (&value_name, "reliable_%s", test_name); |
122 | GAUGER ("TRANSPORT", value_name, (int)(total_bytes * 1000 / 1024 /delta), "kb/s"); | 122 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), |
123 | GNUNET_free(value_name); | 123 | "kb/s"); |
124 | GNUNET_free (value_name); | ||
124 | 125 | ||
125 | if (die_task != GNUNET_SCHEDULER_NO_TASK) | 126 | if (die_task != GNUNET_SCHEDULER_NO_TASK) |
126 | GNUNET_SCHEDULER_cancel (die_task); | 127 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -395,7 +396,8 @@ check () | |||
395 | #endif | 396 | #endif |
396 | ok = 1; | 397 | ok = 1; |
397 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 398 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
398 | "test-transport-api-reliability", "nohelp", options, &run, &ok); | 399 | "test-transport-api-reliability", "nohelp", options, &run, |
400 | &ok); | ||
399 | 401 | ||
400 | return ok; | 402 | return ok; |
401 | } | 403 | } |
@@ -418,7 +420,7 @@ main (int argc, char *argv[]) | |||
418 | char *backup = pch; | 420 | char *backup = pch; |
419 | char *filename = NULL; | 421 | char *filename = NULL; |
420 | char *dotexe; | 422 | char *dotexe; |
421 | char *src_name = strdup (__FILE__); | 423 | char *src_name = strdup (__FILE__); |
422 | char *split = NULL; | 424 | char *split = NULL; |
423 | 425 | ||
424 | /* get executable filename */ | 426 | /* get executable filename */ |
@@ -442,7 +444,7 @@ main (int argc, char *argv[]) | |||
442 | if (split != NULL) | 444 | if (split != NULL) |
443 | { | 445 | { |
444 | split[0] = '\0'; | 446 | split[0] = '\0'; |
445 | test_name = strdup(&filename[strlen(src_name)+1]); | 447 | test_name = strdup (&filename[strlen (src_name) + 1]); |
446 | } | 448 | } |
447 | else | 449 | else |
448 | test_name = NULL; | 450 | test_name = NULL; |
@@ -450,23 +452,20 @@ main (int argc, char *argv[]) | |||
450 | GNUNET_free (src_name); | 452 | GNUNET_free (src_name); |
451 | GNUNET_free (backup); | 453 | GNUNET_free (backup); |
452 | 454 | ||
453 | if ((strstr (argv[0], "tcp_nat") != NULL) || (strstr (argv[0], "udp_nat") != NULL)) | 455 | if ((strstr (argv[0], "tcp_nat") != NULL) || |
456 | (strstr (argv[0], "udp_nat") != NULL)) | ||
454 | { | 457 | { |
455 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); | 458 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); |
456 | if (GNUNET_NO == nat_res) | 459 | if (GNUNET_NO == nat_res) |
457 | { | 460 | { |
458 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 461 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
459 | "Cannot run NAT test: `%s' %s \n", | 462 | "gnunet-nat-server", "SUID not set"); |
460 | "gnunet-nat-server", | ||
461 | "SUID not set"); | ||
462 | return 0; | 463 | return 0; |
463 | } | 464 | } |
464 | if (GNUNET_SYSERR == nat_res) | 465 | if (GNUNET_SYSERR == nat_res) |
465 | { | 466 | { |
466 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 467 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
467 | "Cannot run NAT test: `%s' %s \n", | 468 | "gnunet-nat-server", "file not found"); |
468 | "gnunet-nat-server", | ||
469 | "file not found"); | ||
470 | return 0; | 469 | return 0; |
471 | } | 470 | } |
472 | } | 471 | } |
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index 74afc9c90..6a86617a9 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c | |||
@@ -123,9 +123,10 @@ end () | |||
123 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 123 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; |
124 | fprintf (stderr, "\nThroughput was %llu kb/s\n", | 124 | fprintf (stderr, "\nThroughput was %llu kb/s\n", |
125 | total_bytes * 1000 / 1024 / delta); | 125 | total_bytes * 1000 / 1024 / delta); |
126 | GNUNET_asprintf(&value_name, "unreliable_%s", test_name); | 126 | GNUNET_asprintf (&value_name, "unreliable_%s", test_name); |
127 | GAUGER ("TRANSPORT", value_name, (int)(total_bytes * 1000 / 1024 /delta), "kb/s"); | 127 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), |
128 | GNUNET_free(value_name); | 128 | "kb/s"); |
129 | GNUNET_free (value_name); | ||
129 | 130 | ||
130 | if (die_task != GNUNET_SCHEDULER_NO_TASK) | 131 | if (die_task != GNUNET_SCHEDULER_NO_TASK) |
131 | GNUNET_SCHEDULER_cancel (die_task); | 132 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -140,6 +141,7 @@ end () | |||
140 | ok = 0; | 141 | ok = 0; |
141 | 142 | ||
142 | int i; | 143 | int i; |
144 | |||
143 | for (i = 0; i < TOTAL_MSGS; i++) | 145 | for (i = 0; i < TOTAL_MSGS; i++) |
144 | { | 146 | { |
145 | if (get_bit (bitmap, i) == 0) | 147 | if (get_bit (bitmap, i) == 0) |
@@ -342,9 +344,8 @@ notify_ready (void *cls, size_t size, void *buf) | |||
342 | while (size - ret >= s); | 344 | while (size - ret >= s); |
343 | if (n < TOTAL_MSGS) | 345 | if (n < TOTAL_MSGS) |
344 | { | 346 | { |
345 | th = | 347 | th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, TIMEOUT, |
346 | GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, TIMEOUT, | 348 | ¬ify_ready, NULL); |
347 | ¬ify_ready, NULL); | ||
348 | msg_scheduled = n; | 349 | msg_scheduled = n; |
349 | } | 350 | } |
350 | else | 351 | else |
@@ -353,9 +354,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
353 | "All messages scheduled to be sent!!\n"); | 354 | "All messages scheduled to be sent!!\n"); |
354 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | 355 | if (GNUNET_SCHEDULER_NO_TASK != die_task) |
355 | GNUNET_SCHEDULER_cancel (die_task); | 356 | GNUNET_SCHEDULER_cancel (die_task); |
356 | die_task = | 357 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
357 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, | ||
358 | NULL); | ||
359 | } | 358 | } |
360 | if (n % 5000 == 0) | 359 | if (n % 5000 == 0) |
361 | { | 360 | { |
@@ -460,7 +459,8 @@ check () | |||
460 | ok = GNUNET_SYSERR; | 459 | ok = GNUNET_SYSERR; |
461 | 460 | ||
462 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 461 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
463 | "test-transport-api-unreliability", "nohelp", options, &run, &ok); | 462 | "test-transport-api-unreliability", "nohelp", options, |
463 | &run, &ok); | ||
464 | 464 | ||
465 | return ok; | 465 | return ok; |
466 | } | 466 | } |
@@ -483,7 +483,7 @@ main (int argc, char *argv[]) | |||
483 | char *backup = pch; | 483 | char *backup = pch; |
484 | char *filename = NULL; | 484 | char *filename = NULL; |
485 | char *dotexe; | 485 | char *dotexe; |
486 | char *src_name = strdup (__FILE__); | 486 | char *src_name = strdup (__FILE__); |
487 | char *split = NULL; | 487 | char *split = NULL; |
488 | 488 | ||
489 | /* get executable filename */ | 489 | /* get executable filename */ |
@@ -507,7 +507,7 @@ main (int argc, char *argv[]) | |||
507 | if (split != NULL) | 507 | if (split != NULL) |
508 | { | 508 | { |
509 | split[0] = '\0'; | 509 | split[0] = '\0'; |
510 | test_name = strdup(&filename[strlen(src_name)+1]); | 510 | test_name = strdup (&filename[strlen (src_name) + 1]); |
511 | } | 511 | } |
512 | else | 512 | else |
513 | test_name = NULL; | 513 | test_name = NULL; |
@@ -515,23 +515,20 @@ main (int argc, char *argv[]) | |||
515 | GNUNET_free (src_name); | 515 | GNUNET_free (src_name); |
516 | GNUNET_free (backup); | 516 | GNUNET_free (backup); |
517 | 517 | ||
518 | if ((strstr (argv[0], "tcp_nat") != NULL) || (strstr (argv[0], "udp_nat") != NULL)) | 518 | if ((strstr (argv[0], "tcp_nat") != NULL) || |
519 | (strstr (argv[0], "udp_nat") != NULL)) | ||
519 | { | 520 | { |
520 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); | 521 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); |
521 | if (GNUNET_NO == nat_res) | 522 | if (GNUNET_NO == nat_res) |
522 | { | 523 | { |
523 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 524 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
524 | "Cannot run NAT test: `%s' %s \n", | 525 | "gnunet-nat-server", "SUID not set"); |
525 | "gnunet-nat-server", | ||
526 | "SUID not set"); | ||
527 | return 0; | 526 | return 0; |
528 | } | 527 | } |
529 | if (GNUNET_SYSERR == nat_res) | 528 | if (GNUNET_SYSERR == nat_res) |
530 | { | 529 | { |
531 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 530 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
532 | "Cannot run NAT test: `%s' %s \n", | 531 | "gnunet-nat-server", "file not found"); |
533 | "gnunet-nat-server", | ||
534 | "file not found"); | ||
535 | return 0; | 532 | return 0; |
536 | } | 533 | } |
537 | } | 534 | } |