aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-07-19 13:01:38 +0000
committerNathan S. Evans <evans@in.tum.de>2011-07-19 13:01:38 +0000
commit76ec87b72c383c5366a3479a96ad0a7fe74ec938 (patch)
treedd3676ff3f2163abc9f3d95d6c80629ff5d5b86a /src
parent6fad08b4421440444a1c71ea7a5b80ef87066a01 (diff)
downloadgnunet-76ec87b72c383c5366a3479a96ad0a7fe74ec938.tar.gz
gnunet-76ec87b72c383c5366a3479a96ad0a7fe74ec938.zip
changes
Diffstat (limited to 'src')
-rw-r--r--src/testing/testing_peergroup.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c
index 81294a6e3..e6bb3d63b 100644
--- a/src/testing/testing_peergroup.c
+++ b/src/testing/testing_peergroup.c
@@ -377,7 +377,7 @@ internal_topology_callback(
377 if (pg_start_ctx->topology_output_file != NULL) 377 if (pg_start_ctx->topology_output_file != NULL)
378 { 378 {
379 second_str = GNUNET_strdup(GNUNET_i2s(second)); 379 second_str = GNUNET_strdup(GNUNET_i2s(second));
380 temp = GNUNET_asprintf(&temp_str, "\t\"%s\" -> \"%s\"\n", GNUNET_i2s(first), second_str); 380 temp = GNUNET_asprintf(&temp_str, "\t\"%s\" -- \"%s\"\n", GNUNET_i2s(first), second_str);
381 GNUNET_free(second_str); 381 GNUNET_free(second_str);
382 if (temp > 0) 382 if (temp > 0)
383 GNUNET_DISK_file_write(pg_start_ctx->topology_output_file, temp_str, temp); 383 GNUNET_DISK_file_write(pg_start_ctx->topology_output_file, temp_str, temp);
@@ -607,16 +607,16 @@ write_topology_cb (void *cls,
607 607
608 topo_ctx = (struct TopologyOutputContext *)cls; 608 topo_ctx = (struct TopologyOutputContext *)cls;
609 GNUNET_assert(topo_ctx->file != NULL); 609 GNUNET_assert(topo_ctx->file != NULL);
610 if (emsg == NULL) 610 if ((emsg == NULL) && (first != NULL) && (second != NULL))
611 { 611 {
612 GNUNET_assert(first != NULL); 612 GNUNET_assert(first != NULL);
613 GNUNET_assert(second != NULL); 613 GNUNET_assert(second != NULL);
614 temp_pid2 = GNUNET_strdup(GNUNET_i2s(second)); 614 temp_pid2 = GNUNET_strdup(GNUNET_i2s(second));
615 temp = GNUNET_asprintf(&temp_str, "\t%s -> %s\n", GNUNET_i2s(first), temp_pid2); 615 temp = GNUNET_asprintf(&temp_str, "\t\"%s\" -- \"%s\"\n", GNUNET_i2s(first), temp_pid2);
616 GNUNET_free(temp_pid2); 616 GNUNET_free(temp_pid2);
617 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp); 617 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp);
618 } 618 }
619 else 619 else if ((emsg == NULL) && (first == NULL) && (second == NULL))
620 { 620 {
621 temp = GNUNET_asprintf(&temp_str, "}\n"); 621 temp = GNUNET_asprintf(&temp_str, "}\n");
622 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp); 622 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp);
@@ -624,6 +624,14 @@ write_topology_cb (void *cls,
624 topo_ctx->notify_cb(topo_ctx->notify_cb_cls, NULL); 624 topo_ctx->notify_cb(topo_ctx->notify_cb_cls, NULL);
625 GNUNET_free(topo_ctx); 625 GNUNET_free(topo_ctx);
626 } 626 }
627 else
628 {
629 temp = GNUNET_asprintf(&temp_str, "}\n");
630 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp);
631 GNUNET_DISK_file_close(topo_ctx->file);
632 topo_ctx->notify_cb(topo_ctx->notify_cb_cls, emsg);
633 GNUNET_free(topo_ctx);
634 }
627} 635}
628 636
629/** 637/**
@@ -657,7 +665,7 @@ GNUNET_TESTING_peergroup_topology_to_file(struct GNUNET_TESTING_PeerGroup *pg,
657 return; 665 return;
658 } 666 }
659 667
660 temp = GNUNET_asprintf(&temp_str, "digraph G {\n"); 668 temp = GNUNET_asprintf(&temp_str, "strict graph G {\n");
661 if (temp > 0) 669 if (temp > 0)
662 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp); 670 GNUNET_DISK_file_write(topo_ctx->file, temp_str, temp);
663 GNUNET_free_non_null(temp_str); 671 GNUNET_free_non_null(temp_str);
@@ -776,7 +784,7 @@ GNUNET_TESTING_peergroup_start(const struct GNUNET_CONFIGURATION_Handle *cfg,
776 if (pg_start_ctx->topology_output_file != NULL) 784 if (pg_start_ctx->topology_output_file != NULL)
777 { 785 {
778 GNUNET_free(temp_str); 786 GNUNET_free(temp_str);
779 temp = GNUNET_asprintf(&temp_str, "digraph G {\n"); 787 temp = GNUNET_asprintf(&temp_str, "strict graph G {\n");
780 if (temp > 0) 788 if (temp > 0)
781 GNUNET_DISK_file_write(pg_start_ctx->topology_output_file, temp_str, temp); 789 GNUNET_DISK_file_write(pg_start_ctx->topology_output_file, temp_str, temp);
782 } 790 }