diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-03-18 10:56:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-03-18 10:56:52 +0000 |
commit | b7847284934b21a228b332daf15804e2605e3355 (patch) | |
tree | b07f86904ba4852787e607b1a37c1cf40e68ea89 /src/dv | |
parent | ff0c0c5eb34e719b56d969ae15ee9e311c446553 (diff) | |
download | gnunet-b7847284934b21a228b332daf15804e2605e3355.tar.gz gnunet-b7847284934b21a228b332daf15804e2605e3355.zip |
-fix
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 4 | ||||
-rw-r--r-- | src/dv/test_transport_api_dv.c | 31 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 352a5862d..e0a47348e 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -740,7 +740,7 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
740 | return; /* is a DV-neighbor */ | 740 | return; /* is a DV-neighbor */ |
741 | GNUNET_STATISTICS_update (stats, | 741 | GNUNET_STATISTICS_update (stats, |
742 | "# peers connected (1-hop)", | 742 | "# peers connected (1-hop)", |
743 | -1 1, GNUNET_NO); | 743 | 1, GNUNET_NO); |
744 | neighbor = GNUNET_malloc (sizeof (struct DirectNeighbor)); | 744 | neighbor = GNUNET_malloc (sizeof (struct DirectNeighbor)); |
745 | neighbor->peer = *peer; | 745 | neighbor->peer = *peer; |
746 | GNUNET_assert (GNUNET_YES == | 746 | GNUNET_assert (GNUNET_YES == |
@@ -1386,7 +1386,7 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1386 | } | 1386 | } |
1387 | GNUNET_STATISTICS_update (stats, | 1387 | GNUNET_STATISTICS_update (stats, |
1388 | "# peers connected (1-hop)", | 1388 | "# peers connected (1-hop)", |
1389 | -1 1, GNUNET_NO); | 1389 | -1, GNUNET_NO); |
1390 | cleanup_neighbor (neighbor); | 1390 | cleanup_neighbor (neighbor); |
1391 | GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors, | 1391 | GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors, |
1392 | &refresh_routes, | 1392 | &refresh_routes, |
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index ef3ba4e7c..e36622f2f 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c | |||
@@ -484,6 +484,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { | |||
484 | {NULL, 0, 0} | 484 | {NULL, 0, 0} |
485 | }; | 485 | }; |
486 | 486 | ||
487 | |||
487 | /** | 488 | /** |
488 | * Notify of all peer1's peers, once peer 2 is found, schedule connect | 489 | * Notify of all peer1's peers, once peer 2 is found, schedule connect |
489 | * to peer two for message send. | 490 | * to peer two for message send. |
@@ -525,6 +526,7 @@ connect_notify_peer2 (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
525 | } | 526 | } |
526 | } | 527 | } |
527 | 528 | ||
529 | |||
528 | static void | 530 | static void |
529 | init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, | 531 | init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, |
530 | const struct GNUNET_PeerIdentity *my_identity) | 532 | const struct GNUNET_PeerIdentity *my_identity) |
@@ -535,6 +537,7 @@ init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, | |||
535 | total_server_connections++; | 537 | total_server_connections++; |
536 | } | 538 | } |
537 | 539 | ||
540 | |||
538 | /** | 541 | /** |
539 | * Notify of all peer1's peers, once peer 2 is found, schedule connect | 542 | * Notify of all peer1's peers, once peer 2 is found, schedule connect |
540 | * to peer two for message send. | 543 | * to peer two for message send. |
@@ -566,6 +569,7 @@ connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
566 | } | 569 | } |
567 | } | 570 | } |
568 | 571 | ||
572 | |||
569 | static void | 573 | static void |
570 | init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, | 574 | init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, |
571 | const struct GNUNET_PeerIdentity *my_identity) | 575 | const struct GNUNET_PeerIdentity *my_identity) |
@@ -624,6 +628,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
624 | } | 628 | } |
625 | } | 629 | } |
626 | 630 | ||
631 | |||
627 | static void | 632 | static void |
628 | send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 633 | send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
629 | { | 634 | { |
@@ -706,6 +711,7 @@ send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
706 | "from send_other_messages"); | 711 | "from send_other_messages"); |
707 | } | 712 | } |
708 | 713 | ||
714 | |||
709 | static void | 715 | static void |
710 | topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, | 716 | topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, |
711 | const struct GNUNET_PeerIdentity *second, uint32_t distance, | 717 | const struct GNUNET_PeerIdentity *second, uint32_t distance, |
@@ -860,6 +866,7 @@ all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
860 | } | 866 | } |
861 | } | 867 | } |
862 | 868 | ||
869 | |||
863 | static void | 870 | static void |
864 | peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id, | 871 | peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id, |
865 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 872 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -926,6 +933,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id, | |||
926 | } | 933 | } |
927 | } | 934 | } |
928 | 935 | ||
936 | |||
929 | /** | 937 | /** |
930 | * Callback indicating that the hostkey was created for a peer. | 938 | * Callback indicating that the hostkey was created for a peer. |
931 | * | 939 | * |
@@ -981,6 +989,7 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id, | |||
981 | } | 989 | } |
982 | } | 990 | } |
983 | 991 | ||
992 | |||
984 | static void | 993 | static void |
985 | run (void *cls, char *const *args, const char *cfgfile, | 994 | run (void *cls, char *const *args, const char *cfgfile, |
986 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 995 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -1116,8 +1125,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1116 | 1125 | ||
1117 | } | 1126 | } |
1118 | 1127 | ||
1119 | static int | 1128 | |
1120 | check () | 1129 | int |
1130 | main (int argc, char *argv[]) | ||
1121 | { | 1131 | { |
1122 | int ret; | 1132 | int ret; |
1123 | 1133 | ||
@@ -1129,6 +1139,9 @@ check () | |||
1129 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1139 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1130 | GNUNET_GETOPT_OPTION_END | 1140 | GNUNET_GETOPT_OPTION_END |
1131 | }; | 1141 | }; |
1142 | GNUNET_log_setup ("test-transport-dv", | ||
1143 | "WARNING", | ||
1144 | NULL); | ||
1132 | ret = | 1145 | ret = |
1133 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 1146 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
1134 | "test-transport-dv", "nohelp", options, &run, &ok); | 1147 | "test-transport-dv", "nohelp", options, &run, &ok); |
@@ -1137,18 +1150,6 @@ check () | |||
1137 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1150 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1138 | "`test-transport-dv': Failed with error code %d\n", ret); | 1151 | "`test-transport-dv': Failed with error code %d\n", ret); |
1139 | } | 1152 | } |
1140 | return ok; | ||
1141 | } | ||
1142 | |||
1143 | int | ||
1144 | main (int argc, char *argv[]) | ||
1145 | { | ||
1146 | int ret; | ||
1147 | |||
1148 | GNUNET_log_setup ("test-transport-dv", | ||
1149 | "WARNING", | ||
1150 | NULL); | ||
1151 | ret = check (); | ||
1152 | /** | 1153 | /** |
1153 | * Need to remove base directory, subdirectories taken care | 1154 | * Need to remove base directory, subdirectories taken care |
1154 | * of by the testing framework. | 1155 | * of by the testing framework. |
@@ -1158,7 +1159,7 @@ main (int argc, char *argv[]) | |||
1158 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1159 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1159 | "Failed to remove testing directory %s\n", test_directory); | 1160 | "Failed to remove testing directory %s\n", test_directory); |
1160 | } | 1161 | } |
1161 | return ret; | 1162 | return (GNUNET_OK == ret) ? 0 : 1; |
1162 | } | 1163 | } |
1163 | 1164 | ||
1164 | /* end of test_transport_api_dv.c */ | 1165 | /* end of test_transport_api_dv.c */ |