aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_unreliability.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_transport_api_unreliability.c')
-rw-r--r--src/transport/test_transport_api_unreliability.c41
1 files changed, 19 insertions, 22 deletions
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 &notify_ready, NULL);
347 &notify_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 }