diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-06-05 13:07:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-06-05 13:07:13 +0000 |
commit | 187f3ee1b6edac986b7bc46c62c86a138290b147 (patch) | |
tree | 809c2751509e7111ad26e802e5df8d2332c24455 /src/transport/test_transport_api_reliability.c | |
parent | 2850662595ec7d25aaaf9674e987449375960c23 (diff) | |
download | gnunet-187f3ee1b6edac986b7bc46c62c86a138290b147.tar.gz gnunet-187f3ee1b6edac986b7bc46c62c86a138290b147.zip |
adapting testcases to use new API
Diffstat (limited to 'src/transport/test_transport_api_reliability.c')
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 343 |
1 files changed, 189 insertions, 154 deletions
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 2d44167d4..45642486c 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -95,6 +95,8 @@ static struct GNUNET_TIME_Absolute start_time; | |||
95 | 95 | ||
96 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 96 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
97 | 97 | ||
98 | static GNUNET_SCHEDULER_TaskIdentifier tct; | ||
99 | |||
98 | static char * key_file_p1; | 100 | static char * key_file_p1; |
99 | static char * cert_file_p1; | 101 | static char * cert_file_p1; |
100 | 102 | ||
@@ -105,7 +107,6 @@ static int msg_scheduled; | |||
105 | static int msg_sent; | 107 | static int msg_sent; |
106 | static int msg_recv_expected; | 108 | static int msg_recv_expected; |
107 | static int msg_recv; | 109 | static int msg_recv; |
108 | static struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle; | ||
109 | 110 | ||
110 | #if VERBOSE | 111 | #if VERBOSE |
111 | #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) | 112 | #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) |
@@ -163,10 +164,19 @@ end_badly (void *cls, | |||
163 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 164 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
164 | { | 165 | { |
165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 166 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
166 | "Reliability failed: \nLast message sent %u \nNext message scheduled %u\nLast message received %u\nMessage expected %u \n ", msg_sent, msg_scheduled, msg_recv, msg_recv_expected); | 167 | "Reliability failed: Last message sent %u, Next message scheduled %u, Last message received %u, Message expected %u\n", |
168 | msg_sent, | ||
169 | msg_scheduled, | ||
170 | msg_recv, | ||
171 | msg_recv_expected); | ||
167 | GNUNET_break (0); | 172 | GNUNET_break (0); |
168 | GNUNET_TRANSPORT_disconnect (p1.th); | 173 | GNUNET_TRANSPORT_disconnect (p1.th); |
169 | GNUNET_TRANSPORT_disconnect (p2.th); | 174 | GNUNET_TRANSPORT_disconnect (p2.th); |
175 | if (GNUNET_SCHEDULER_NO_TASK != tct) | ||
176 | { | ||
177 | GNUNET_SCHEDULER_cancel (tct); | ||
178 | tct = GNUNET_SCHEDULER_NO_TASK; | ||
179 | } | ||
170 | ok = 1; | 180 | ok = 1; |
171 | } | 181 | } |
172 | 182 | ||
@@ -331,11 +341,65 @@ notify_ready (void *cls, size_t size, void *buf) | |||
331 | 341 | ||
332 | 342 | ||
333 | static void | 343 | static void |
344 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | ||
345 | { | ||
346 | connected--; | ||
347 | #if VERBOSE | ||
348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
349 | "Peer `%4s' disconnected (%p)!\n", | ||
350 | GNUNET_i2s (peer), cls); | ||
351 | #endif | ||
352 | } | ||
353 | |||
354 | |||
355 | static void | ||
356 | exchange_hello_last (void *cls, | ||
357 | const struct GNUNET_MessageHeader *message) | ||
358 | { | ||
359 | struct PeerContext *me = cls; | ||
360 | |||
361 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
362 | "Exchanging HELLO of size %d with peer (%s)!\n", | ||
363 | (int) GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message), | ||
364 | GNUNET_i2s (&me->id)); | ||
365 | GNUNET_assert (message != NULL); | ||
366 | GNUNET_assert (GNUNET_OK == | ||
367 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | ||
368 | message, &me->id)); | ||
369 | GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL); | ||
370 | } | ||
371 | |||
372 | |||
373 | |||
374 | static void | ||
375 | exchange_hello (void *cls, | ||
376 | const struct GNUNET_MessageHeader *message) | ||
377 | { | ||
378 | struct PeerContext *me = cls; | ||
379 | |||
380 | GNUNET_assert (message != NULL); | ||
381 | GNUNET_assert (GNUNET_OK == | ||
382 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | ||
383 | message, &me->id)); | ||
384 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
385 | "Exchanging HELLO of size %d from peer %s!\n", | ||
386 | (int) GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message), | ||
387 | GNUNET_i2s (&me->id)); | ||
388 | GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); | ||
389 | } | ||
390 | |||
391 | |||
392 | static void | ||
334 | notify_connect (void *cls, | 393 | notify_connect (void *cls, |
335 | const struct GNUNET_PeerIdentity *peer, | 394 | const struct GNUNET_PeerIdentity *peer, |
336 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 395 | const struct GNUNET_TRANSPORT_ATS_Information *ats, |
337 | uint32_t ats_count) | 396 | uint32_t ats_count) |
338 | { | 397 | { |
398 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
399 | "Peer `%4s' connected to us (%p)!\n", | ||
400 | GNUNET_i2s (peer), | ||
401 | cls); | ||
402 | connected++; | ||
339 | if (cls == &p1) | 403 | if (cls == &p1) |
340 | { | 404 | { |
341 | GNUNET_TRANSPORT_set_quota (p1.th, | 405 | GNUNET_TRANSPORT_set_quota (p1.th, |
@@ -343,7 +407,6 @@ notify_connect (void *cls, | |||
343 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024), | 407 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024), |
344 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024)); | 408 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024)); |
345 | start_time = GNUNET_TIME_absolute_get (); | 409 | start_time = GNUNET_TIME_absolute_get (); |
346 | connected++; | ||
347 | } | 410 | } |
348 | else | 411 | else |
349 | { | 412 | { |
@@ -351,37 +414,23 @@ notify_connect (void *cls, | |||
351 | &p1.id, | 414 | &p1.id, |
352 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024), | 415 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024), |
353 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024)); | 416 | GNUNET_BANDWIDTH_value_init (1024 * 1024 * 1024)); |
354 | connected++; | ||
355 | } | 417 | } |
356 | 418 | if (2 == connected) | |
357 | if (connected == 2) | ||
358 | { | 419 | { |
359 | 420 | GNUNET_SCHEDULER_cancel (die_task); | |
360 | if ((transmit_handle!=NULL) && (cls == NULL)) | 421 | GNUNET_SCHEDULER_cancel (tct); |
361 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle); | 422 | tct = GNUNET_SCHEDULER_NO_TASK; |
362 | if ((transmit_handle!=NULL) && (cls == &transmit_handle)) | 423 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); |
363 | transmit_handle=NULL; | 424 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); |
425 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | ||
426 | &end_badly, NULL); | ||
364 | GNUNET_TRANSPORT_notify_transmit_ready (p2.th, | 427 | GNUNET_TRANSPORT_notify_transmit_ready (p2.th, |
365 | &p1.id, | 428 | &p1.id, |
366 | get_size (0), 0, TIMEOUT, | 429 | get_size (0), 0, TIMEOUT, |
367 | ¬ify_ready, | 430 | ¬ify_ready, |
368 | NULL); | 431 | NULL); |
432 | |||
369 | } | 433 | } |
370 | #if VERBOSE | ||
371 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
372 | "Peer `%4s' connected to us (%p)!\n", GNUNET_i2s (peer), cls); | ||
373 | #endif | ||
374 | } | ||
375 | |||
376 | |||
377 | static void | ||
378 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | ||
379 | { | ||
380 | #if VERBOSE | ||
381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
382 | "Peer `%4s' disconnected (%p)!\n", | ||
383 | GNUNET_i2s (peer), cls); | ||
384 | #endif | ||
385 | } | 434 | } |
386 | 435 | ||
387 | 436 | ||
@@ -401,62 +450,77 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
401 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 450 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
402 | 451 | ||
403 | if (is_https) | 452 | if (is_https) |
404 | { | 453 | { |
405 | struct stat sbuf; | 454 | struct stat sbuf; |
406 | if (p==&p1) | 455 | if (p==&p1) |
407 | { | 456 | { |
408 | if (GNUNET_CONFIGURATION_have_value (p->cfg, | 457 | if (GNUNET_CONFIGURATION_have_value (p->cfg, |
409 | "transport-https", "KEY_FILE")) | 458 | "transport-https", "KEY_FILE")) |
410 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p1); | 459 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p1); |
411 | if (key_file_p1 == NULL) | 460 | if (key_file_p1 == NULL) |
412 | GNUNET_asprintf(&key_file_p1,"https_p1.key"); | 461 | GNUNET_asprintf(&key_file_p1,"https_p1.key"); |
413 | if (0 == stat (key_file_p1, &sbuf )) | 462 | if (0 == stat (key_file_p1, &sbuf )) |
414 | { | 463 | { |
415 | if (0 == remove(key_file_p1)) | 464 | if (0 == remove(key_file_p1)) |
416 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p1); | 465 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
417 | else | 466 | "Successfully removed existing private key file `%s'\n", |
418 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p1); | 467 | key_file_p1); |
419 | } | 468 | else |
420 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE")) | 469 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
421 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p1); | 470 | "Failed to remove private key file `%s'\n", |
422 | if (cert_file_p1 == NULL) | 471 | key_file_p1); |
423 | GNUNET_asprintf(&cert_file_p1,"https_p1.cert"); | 472 | } |
424 | if (0 == stat (cert_file_p1, &sbuf )) | 473 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE")) |
425 | { | 474 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p1); |
426 | if (0 == remove(cert_file_p1)) | 475 | if (cert_file_p1 == NULL) |
427 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p1); | 476 | GNUNET_asprintf(&cert_file_p1,"https_p1.cert"); |
428 | else | 477 | if (0 == stat (cert_file_p1, &sbuf )) |
429 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p1); | 478 | { |
430 | } | 479 | if (0 == remove(cert_file_p1)) |
431 | } | 480 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
432 | else if (p==&p2) | 481 | "Successfully removed existing certificate file `%s'\n", |
433 | { | 482 | cert_file_p1); |
434 | if (GNUNET_CONFIGURATION_have_value (p->cfg, | 483 | else |
435 | "transport-https", "KEY_FILE")) | 484 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
436 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p2); | 485 | "Failed to remove existing certificate file `%s'\n", |
437 | if (key_file_p2 == NULL) | 486 | cert_file_p1); |
438 | GNUNET_asprintf(&key_file_p2,"https_p2.key"); | 487 | } |
439 | if (0 == stat (key_file_p2, &sbuf )) | 488 | } |
440 | { | 489 | else if (p==&p2) |
441 | if (0 == remove(key_file_p2)) | 490 | { |
442 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p2); | 491 | if (GNUNET_CONFIGURATION_have_value (p->cfg, |
443 | else | 492 | "transport-https", "KEY_FILE")) |
444 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p2); | 493 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p2); |
445 | } | 494 | if (key_file_p2 == NULL) |
446 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE")) | 495 | GNUNET_asprintf(&key_file_p2,"https_p2.key"); |
447 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p2); | 496 | if (0 == stat (key_file_p2, &sbuf )) |
448 | if (cert_file_p2 == NULL) | 497 | { |
449 | GNUNET_asprintf(&cert_file_p2,"https_p2.cert"); | 498 | if (0 == remove(key_file_p2)) |
450 | if (0 == stat (cert_file_p2, &sbuf )) | 499 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
451 | { | 500 | "Successfully removed existing private key file `%s'\n", |
452 | if (0 == remove(cert_file_p2)) | 501 | key_file_p2); |
453 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p2); | 502 | else |
454 | else | 503 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
455 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p2); | 504 | "Failed to remove private key file `%s'\n", |
456 | } | 505 | key_file_p2); |
457 | } | 506 | } |
458 | } | 507 | if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE")) |
459 | 508 | GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p2); | |
509 | if (cert_file_p2 == NULL) | ||
510 | GNUNET_asprintf(&cert_file_p2,"https_p2.cert"); | ||
511 | if (0 == stat (cert_file_p2, &sbuf )) | ||
512 | { | ||
513 | if (0 == remove(cert_file_p2)) | ||
514 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
515 | "Successfully removed existing certificate file `%s'\n", | ||
516 | cert_file_p2); | ||
517 | else | ||
518 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
519 | "Failed to remove existing certificate file `%s'\n", | ||
520 | cert_file_p2); | ||
521 | } | ||
522 | } | ||
523 | } | ||
460 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, | 524 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, |
461 | p, | 525 | p, |
462 | ¬ify_receive, | 526 | ¬ify_receive, |
@@ -465,69 +529,6 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
465 | GNUNET_assert (p->th != NULL); | 529 | GNUNET_assert (p->th != NULL); |
466 | } | 530 | } |
467 | 531 | ||
468 | static size_t | ||
469 | notify_ready_connect (void *cls, size_t size, void *buf) | ||
470 | { | ||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | static void | ||
475 | exchange_hello_last (void *cls, | ||
476 | const struct GNUNET_MessageHeader *message) | ||
477 | { | ||
478 | struct PeerContext *me = cls; | ||
479 | transmit_handle = NULL; | ||
480 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, me); | ||
481 | #if VERBOSE | ||
482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
483 | "Exchanging HELLO with peer (%p)!\n", cls); | ||
484 | #endif | ||
485 | GNUNET_assert (ok >= 3); | ||
486 | OKPP; | ||
487 | GNUNET_assert (message != NULL); | ||
488 | GNUNET_assert (GNUNET_OK == | ||
489 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | ||
490 | message, &me->id)); | ||
491 | |||
492 | GNUNET_assert(NULL != (transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, | ||
493 | &p1.id, | ||
494 | sizeof (struct GNUNET_MessageHeader), 0, | ||
495 | TIMEOUT, | ||
496 | ¬ify_ready_connect, | ||
497 | &transmit_handle))); | ||
498 | |||
499 | /* both HELLOs exchanged, get ready to test transmission! */ | ||
500 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
501 | "Finished exchanging HELLOs, now waiting for transmission!\n"); | ||
502 | } | ||
503 | |||
504 | |||
505 | static void | ||
506 | exchange_hello (void *cls, | ||
507 | const struct GNUNET_MessageHeader *message) | ||
508 | { | ||
509 | struct PeerContext *me = cls; | ||
510 | |||
511 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, me); | ||
512 | #if VERBOSE | ||
513 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
514 | "Exchanging HELLO with peer (%p)!\n", cls); | ||
515 | #endif | ||
516 | GNUNET_assert (ok >= 2); | ||
517 | OKPP; | ||
518 | GNUNET_assert (message != NULL); | ||
519 | GNUNET_assert (GNUNET_OK == | ||
520 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | ||
521 | message, &me->id)); | ||
522 | |||
523 | #if VERBOSE | ||
524 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
525 | "Received HELLO size %d\n", | ||
526 | GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); | ||
527 | #endif | ||
528 | GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); | ||
529 | GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); | ||
530 | } | ||
531 | 532 | ||
532 | /** | 533 | /** |
533 | * Return the actual path to a file found in the current | 534 | * Return the actual path to a file found in the current |
@@ -640,6 +641,23 @@ check_gnunet_nat_binary(char *binary) | |||
640 | #endif | 641 | #endif |
641 | } | 642 | } |
642 | 643 | ||
644 | |||
645 | static void | ||
646 | try_connect (void *cls, | ||
647 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
648 | { | ||
649 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
650 | "Asking peers to connect...\n"); | ||
651 | GNUNET_TRANSPORT_try_connect (p2.th, | ||
652 | &p1.id); | ||
653 | GNUNET_TRANSPORT_try_connect (p1.th, | ||
654 | &p2.id); | ||
655 | tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
656 | &try_connect, | ||
657 | NULL); | ||
658 | } | ||
659 | |||
660 | |||
643 | static void | 661 | static void |
644 | run (void *cls, | 662 | run (void *cls, |
645 | char *const *args, | 663 | char *const *args, |
@@ -690,6 +708,8 @@ run (void *cls, | |||
690 | GNUNET_assert(p1.th != NULL); | 708 | GNUNET_assert(p1.th != NULL); |
691 | GNUNET_assert(p2.th != NULL); | 709 | GNUNET_assert(p2.th != NULL); |
692 | GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); | 710 | GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); |
711 | GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); | ||
712 | tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL); | ||
693 | } | 713 | } |
694 | 714 | ||
695 | 715 | ||
@@ -715,7 +735,8 @@ check () | |||
715 | 735 | ||
716 | if ((GNUNET_YES == is_tcp_nat) && (check_gnunet_nat_binary("gnunet-nat-server") != GNUNET_YES)) | 736 | if ((GNUNET_YES == is_tcp_nat) && (check_gnunet_nat_binary("gnunet-nat-server") != GNUNET_YES)) |
717 | { | 737 | { |
718 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Not running NAT test case, binaries not properly installed.\n"); | 738 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
739 | "Not running NAT test case, binaries not properly installed.\n"); | ||
719 | return 0; | 740 | return 0; |
720 | } | 741 | } |
721 | 742 | ||
@@ -731,33 +752,47 @@ check () | |||
731 | if (0 == stat (cert_file_p1, &sbuf )) | 752 | if (0 == stat (cert_file_p1, &sbuf )) |
732 | { | 753 | { |
733 | if (0 == remove(cert_file_p1)) | 754 | if (0 == remove(cert_file_p1)) |
734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p1); | 755 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
756 | "Successfully removed existing certificate file `%s'\n", | ||
757 | cert_file_p1); | ||
735 | else | 758 | else |
736 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p1); | 759 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
760 | "Failed to remove certfile `%s'\n", | ||
761 | cert_file_p1); | ||
737 | } | 762 | } |
738 | 763 | ||
739 | if (0 == stat (key_file_p1, &sbuf )) | 764 | if (0 == stat (key_file_p1, &sbuf )) |
740 | { | 765 | { |
741 | if (0 == remove(key_file_p1)) | 766 | if (0 == remove(key_file_p1)) |
742 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p1); | 767 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
768 | "Successfully removed private key file `%s'\n", | ||
769 | key_file_p1); | ||
743 | else | 770 | else |
744 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p1); | 771 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
772 | "Failed to private key file `%s'\n",key_file_p1); | ||
745 | } | 773 | } |
746 | 774 | ||
747 | if (0 == stat (cert_file_p2, &sbuf )) | 775 | if (0 == stat (cert_file_p2, &sbuf )) |
748 | { | 776 | { |
749 | if (0 == remove(cert_file_p2)) | 777 | if (0 == remove(cert_file_p2)) |
750 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p2); | 778 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
779 | "Successfully removed existing certificate file `%s'\n", | ||
780 | cert_file_p2); | ||
751 | else | 781 | else |
752 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p2); | 782 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
783 | "Failed to remove certfile `%s'\n",cert_file_p2); | ||
753 | } | 784 | } |
754 | 785 | ||
755 | if (0 == stat (key_file_p2, &sbuf )) | 786 | if (0 == stat (key_file_p2, &sbuf )) |
756 | { | 787 | { |
757 | if (0 == remove(key_file_p2)) | 788 | if (0 == remove(key_file_p2)) |
758 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p2); | 789 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
790 | "Successfully removed private key file `%s'\n", | ||
791 | key_file_p2); | ||
759 | else | 792 | else |
760 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p2); | 793 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
794 | "Failed to private key file `%s'\n", | ||
795 | key_file_p2); | ||
761 | } | 796 | } |
762 | GNUNET_free(key_file_p1); | 797 | GNUNET_free(key_file_p1); |
763 | GNUNET_free(key_file_p2); | 798 | GNUNET_free(key_file_p2); |