diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-07-30 14:53:55 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-07-30 14:53:55 +0000 |
commit | 8f1d5a8a9a094b98d1f8a45ae8b9c83bafcf3248 (patch) | |
tree | 2909d984973861eb07c87c452c7d9d4cfca4ea9d /src/transport/test_transport_api_reliability.c | |
parent | 2e42d43da78d245d0319dd76323b7056cd931c1e (diff) | |
download | gnunet-8f1d5a8a9a094b98d1f8a45ae8b9c83bafcf3248.tar.gz gnunet-8f1d5a8a9a094b98d1f8a45ae8b9c83bafcf3248.zip |
- debug output decreased
- private keys and certs removed after all testcases
Diffstat (limited to 'src/transport/test_transport_api_reliability.c')
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 3e22299de..a18175bf4 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -92,6 +92,13 @@ static struct GNUNET_TIME_Absolute start_time; | |||
92 | 92 | ||
93 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 93 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
94 | 94 | ||
95 | static char * key_file_p1; | ||
96 | static char * cert_file_p1; | ||
97 | |||
98 | static char * key_file_p2; | ||
99 | static char * cert_file_p2; | ||
100 | |||
101 | |||
95 | #if VERBOSE | 102 | #if VERBOSE |
96 | #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) | 103 | #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) |
97 | #else | 104 | #else |
@@ -120,6 +127,7 @@ end () | |||
120 | "\nThroughput was %llu kb/s\n", | 127 | "\nThroughput was %llu kb/s\n", |
121 | total_bytes * 1000 / 1024 / delta); | 128 | total_bytes * 1000 / 1024 / delta); |
122 | ok = 0; | 129 | ok = 0; |
130 | |||
123 | } | 131 | } |
124 | 132 | ||
125 | 133 | ||
@@ -369,6 +377,64 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
369 | "-c", cfgname, NULL); | 377 | "-c", cfgname, NULL); |
370 | #endif | 378 | #endif |
371 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 379 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
380 | |||
381 | if (is_https) | ||
382 | { | ||
383 | struct stat sbuf; | ||
384 | if (p==&p1) | ||
385 | { | ||
386 | if (GNUNET_CONFIGURATION_have_value (p->cfg, | ||
387 | "transport-https", "KEY_FILE")) | ||
388 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p1); | ||
389 | else | ||
390 | GNUNET_asprintf(&key_file_p1,"https.key"); | ||
391 | if (0 == stat (key_file_p1, &sbuf )) | ||
392 | { | ||
393 | if (0 == remove(key_file_p1)) | ||
394 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p1); | ||
395 | else | ||
396 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p1); | ||
397 | } | ||
398 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE")) | ||
399 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p1); | ||
400 | else | ||
401 | GNUNET_asprintf(&cert_file_p1,"https.cert"); | ||
402 | if (0 == stat (cert_file_p1, &sbuf )) | ||
403 | { | ||
404 | if (0 == remove(cert_file_p1)) | ||
405 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p1); | ||
406 | else | ||
407 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p1); | ||
408 | } | ||
409 | } | ||
410 | else if (p==&p2) | ||
411 | { | ||
412 | if (GNUNET_CONFIGURATION_have_value (p->cfg, | ||
413 | "transport-https", "KEY_FILE")) | ||
414 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p2); | ||
415 | else | ||
416 | GNUNET_asprintf(&key_file_p2,"https.key"); | ||
417 | if (0 == stat (key_file_p2, &sbuf )) | ||
418 | { | ||
419 | if (0 == remove(key_file_p2)) | ||
420 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p2); | ||
421 | else | ||
422 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p2); | ||
423 | } | ||
424 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE")) | ||
425 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p2); | ||
426 | else | ||
427 | GNUNET_asprintf(&cert_file_p2,"https.cert"); | ||
428 | if (0 == stat (cert_file_p2, &sbuf )) | ||
429 | { | ||
430 | if (0 == remove(cert_file_p2)) | ||
431 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p2); | ||
432 | else | ||
433 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p2); | ||
434 | } | ||
435 | } | ||
436 | } | ||
437 | |||
372 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, | 438 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, |
373 | p, | 439 | p, |
374 | ¬ify_receive, | 440 | ¬ify_receive, |
@@ -499,6 +565,47 @@ check () | |||
499 | options, &run, &ok); | 565 | options, &run, &ok); |
500 | stop_arm (&p1); | 566 | stop_arm (&p1); |
501 | stop_arm (&p2); | 567 | stop_arm (&p2); |
568 | |||
569 | if (is_https) | ||
570 | { | ||
571 | struct stat sbuf; | ||
572 | if (0 == stat (cert_file_p1, &sbuf )) | ||
573 | { | ||
574 | if (0 == remove(cert_file_p1)) | ||
575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p1); | ||
576 | else | ||
577 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p1); | ||
578 | } | ||
579 | |||
580 | if (0 == stat (key_file_p1, &sbuf )) | ||
581 | { | ||
582 | if (0 == remove(key_file_p1)) | ||
583 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p1); | ||
584 | else | ||
585 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p1); | ||
586 | } | ||
587 | |||
588 | if (0 == stat (cert_file_p2, &sbuf )) | ||
589 | { | ||
590 | if (0 == remove(cert_file_p2)) | ||
591 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p2); | ||
592 | else | ||
593 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p2); | ||
594 | } | ||
595 | |||
596 | if (0 == stat (key_file_p2, &sbuf )) | ||
597 | { | ||
598 | if (0 == remove(key_file_p2)) | ||
599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p2); | ||
600 | else | ||
601 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p2); | ||
602 | } | ||
603 | GNUNET_free(key_file_p1); | ||
604 | GNUNET_free(key_file_p2); | ||
605 | GNUNET_free(cert_file_p1); | ||
606 | GNUNET_free(cert_file_p2); | ||
607 | } | ||
608 | |||
502 | return ok; | 609 | return ok; |
503 | } | 610 | } |
504 | 611 | ||