diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-18 20:58:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-18 20:58:31 +0000 |
commit | 44cb69974fb8fa57c4e367af070a6d7bfcda8d7d (patch) | |
tree | 785f65d08939f5cc84b0781e7529f029d7139309 /src | |
parent | 46c0b95062518dfb3212c6fac6641822d68a980b (diff) | |
download | gnunet-44cb69974fb8fa57c4e367af070a6d7bfcda8d7d.tar.gz gnunet-44cb69974fb8fa57c4e367af070a6d7bfcda8d7d.zip |
move -C option from gnunet-transport to gnunet-ats; also, use blacklisting API to implement gnunet-transport -D
Diffstat (limited to 'src')
-rw-r--r-- | src/ats-tool/gnunet-ats.c | 184 | ||||
-rw-r--r-- | src/include/gnunet_transport_service.h | 2 | ||||
-rw-r--r-- | src/transport/gnunet-transport.c | 286 |
3 files changed, 191 insertions, 281 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 9ea603bc1..7a89adc73 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009--2013 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2009--2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -22,6 +22,7 @@ | |||
22 | * @file ats-tool/gnunet-ats.c | 22 | * @file ats-tool/gnunet-ats.c |
23 | * @brief ATS command line tool | 23 | * @brief ATS command line tool |
24 | * @author Matthias Wachs | 24 | * @author Matthias Wachs |
25 | * @author Christian Grothoff | ||
25 | */ | 26 | */ |
26 | #include "platform.h" | 27 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
@@ -105,11 +106,26 @@ static int stat_receive_done; | |||
105 | static int stat_pending; | 106 | static int stat_pending; |
106 | 107 | ||
107 | /** | 108 | /** |
109 | * Which peer should we connect to? | ||
110 | */ | ||
111 | static char *cpid_str; | ||
112 | |||
113 | /** | ||
108 | * ATS performance handle used | 114 | * ATS performance handle used |
109 | */ | 115 | */ |
110 | static struct GNUNET_ATS_PerformanceHandle *ph; | 116 | static struct GNUNET_ATS_PerformanceHandle *ph; |
111 | 117 | ||
112 | /** | 118 | /** |
119 | * Our connectivity handle. | ||
120 | */ | ||
121 | static struct GNUNET_ATS_ConnectivityHandle *ats_ch; | ||
122 | |||
123 | /** | ||
124 | * Handle for address suggestion request. | ||
125 | */ | ||
126 | static struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; | ||
127 | |||
128 | /** | ||
113 | * ATS address list handle used | 129 | * ATS address list handle used |
114 | */ | 130 | */ |
115 | static struct GNUNET_ATS_AddressListHandle *alh; | 131 | static struct GNUNET_ATS_AddressListHandle *alh; |
@@ -234,7 +250,11 @@ free_addr_it (void *cls, | |||
234 | void *value) | 250 | void *value) |
235 | { | 251 | { |
236 | struct ATSAddress *a = value; | 252 | struct ATSAddress *a = value; |
237 | GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_remove (addresses, key, value)); | 253 | |
254 | GNUNET_assert (GNUNET_OK == | ||
255 | GNUNET_CONTAINER_multipeermap_remove (addresses, | ||
256 | key, | ||
257 | value)); | ||
238 | GNUNET_HELLO_address_free (a->address); | 258 | GNUNET_HELLO_address_free (a->address); |
239 | GNUNET_free (a); | 259 | GNUNET_free (a); |
240 | return GNUNET_OK; | 260 | return GNUNET_OK; |
@@ -292,6 +312,17 @@ end (void *cls, | |||
292 | FPRINTF (stdout, | 312 | FPRINTF (stdout, |
293 | _("ATS returned stat_results for %u addresses\n"), | 313 | _("ATS returned stat_results for %u addresses\n"), |
294 | stat_results); | 314 | stat_results); |
315 | |||
316 | if (NULL != ats_sh) | ||
317 | { | ||
318 | GNUNET_ATS_connectivity_suggest_cancel (ats_sh); | ||
319 | ats_sh = NULL; | ||
320 | } | ||
321 | if (NULL != ats_ch) | ||
322 | { | ||
323 | GNUNET_ATS_connectivity_done (ats_ch); | ||
324 | ats_ch = NULL; | ||
325 | } | ||
295 | ret = 0; | 326 | ret = 0; |
296 | } | 327 | } |
297 | 328 | ||
@@ -685,38 +716,35 @@ print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
685 | 716 | ||
686 | 717 | ||
687 | /** | 718 | /** |
688 | * Function called with the result from the test if ATS is | 719 | * Main function that will be run by the scheduler. |
689 | * running. Runs the actual main logic. | ||
690 | * | 720 | * |
691 | * @param cls the `struct GNUNET_CONFIGURATION_Handle *` | 721 | * @param cls closure |
692 | * @param result result of the test, #GNUNET_YES if ATS is running | 722 | * @param args remaining command-line arguments |
723 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
724 | * @param my_cfg configuration | ||
693 | */ | 725 | */ |
694 | static void | 726 | static void |
695 | testservice_ats (void *cls, | 727 | run (void *cls, |
696 | int result) | 728 | char * const *args, |
729 | const char *cfgfile, | ||
730 | const struct GNUNET_CONFIGURATION_Handle *my_cfg) | ||
697 | { | 731 | { |
698 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; | ||
699 | struct GNUNET_PeerIdentity pid; | 732 | struct GNUNET_PeerIdentity pid; |
733 | struct GNUNET_PeerIdentity cpid; | ||
700 | unsigned int c; | 734 | unsigned int c; |
701 | unsigned int type; | 735 | unsigned int type; |
702 | 736 | ||
737 | cfg = (struct GNUNET_CONFIGURATION_Handle *) my_cfg; | ||
703 | addresses = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); | 738 | addresses = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
704 | |||
705 | if (GNUNET_YES != result) | ||
706 | { | ||
707 | FPRINTF (stderr, | ||
708 | _("Service `%s' is not running\n"), | ||
709 | "ats"); | ||
710 | return; | ||
711 | } | ||
712 | |||
713 | stat_results = 0; | 739 | stat_results = 0; |
714 | 740 | ||
741 | c = 0; | ||
715 | if (NULL != opt_pid_str) | 742 | if (NULL != opt_pid_str) |
716 | { | 743 | { |
717 | if (GNUNET_OK | 744 | if (GNUNET_OK != |
718 | != GNUNET_CRYPTO_eddsa_public_key_from_string (opt_pid_str, | 745 | GNUNET_CRYPTO_eddsa_public_key_from_string (opt_pid_str, |
719 | strlen (opt_pid_str), &pid.public_key)) | 746 | strlen (opt_pid_str), |
747 | &pid.public_key)) | ||
720 | { | 748 | { |
721 | FPRINTF (stderr, | 749 | FPRINTF (stderr, |
722 | _("Failed to parse peer identity `%s'\n"), | 750 | _("Failed to parse peer identity `%s'\n"), |
@@ -724,12 +752,27 @@ testservice_ats (void *cls, | |||
724 | return; | 752 | return; |
725 | } | 753 | } |
726 | } | 754 | } |
755 | if (NULL != cpid_str) | ||
756 | { | ||
757 | if (GNUNET_OK != | ||
758 | GNUNET_CRYPTO_eddsa_public_key_from_string (cpid_str, | ||
759 | strlen (cpid_str), | ||
760 | &cpid.public_key)) | ||
761 | { | ||
762 | FPRINTF (stderr, | ||
763 | _("Failed to parse peer identity `%s'\n"), | ||
764 | cpid_str); | ||
765 | return; | ||
766 | } | ||
767 | c++; | ||
768 | } | ||
769 | |||
770 | c += opt_list_all + opt_list_used + opt_monitor + opt_set_pref; | ||
727 | 771 | ||
728 | c = opt_list_all + opt_list_used + opt_monitor + opt_set_pref; | 772 | if (1 < c) |
729 | if ((1 < c)) | ||
730 | { | 773 | { |
731 | FPRINTF (stderr, | 774 | FPRINTF (stderr, |
732 | _("Please select one operation : %s or %s or %s or %s or %s\n"), | 775 | _("Please select one operation: %s or %s or %s or %s or %s\n"), |
733 | "--used", | 776 | "--used", |
734 | "--all", | 777 | "--all", |
735 | "--monitor", | 778 | "--monitor", |
@@ -737,7 +780,7 @@ testservice_ats (void *cls, | |||
737 | "--quotas"); | 780 | "--quotas"); |
738 | return; | 781 | return; |
739 | } | 782 | } |
740 | if ((0 == c)) | 783 | if (0 == c) |
741 | opt_list_used = GNUNET_YES; /* set default */ | 784 | opt_list_used = GNUNET_YES; /* set default */ |
742 | if (opt_print_quotas) | 785 | if (opt_print_quotas) |
743 | { | 786 | { |
@@ -754,7 +797,6 @@ testservice_ats (void *cls, | |||
754 | _("Cannot connect to ATS service, exiting...\n")); | 797 | _("Cannot connect to ATS service, exiting...\n")); |
755 | return; | 798 | return; |
756 | } | 799 | } |
757 | |||
758 | alh = GNUNET_ATS_performance_list_addresses (ph, | 800 | alh = GNUNET_ATS_performance_list_addresses (ph, |
759 | (NULL == opt_pid_str) ? NULL : &pid, | 801 | (NULL == opt_pid_str) ? NULL : &pid, |
760 | GNUNET_YES, | 802 | GNUNET_YES, |
@@ -768,10 +810,11 @@ testservice_ats (void *cls, | |||
768 | return; | 810 | return; |
769 | } | 811 | } |
770 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 812 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
771 | &end, | 813 | &end, |
772 | NULL); | 814 | NULL); |
815 | return; | ||
773 | } | 816 | } |
774 | else if (opt_list_used) | 817 | if (opt_list_used) |
775 | { | 818 | { |
776 | ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); | 819 | ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); |
777 | if (NULL == ph) | 820 | if (NULL == ph) |
@@ -796,8 +839,9 @@ testservice_ats (void *cls, | |||
796 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 839 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
797 | &end, | 840 | &end, |
798 | NULL); | 841 | NULL); |
842 | return; | ||
799 | } | 843 | } |
800 | else if (opt_monitor) | 844 | if (opt_monitor) |
801 | { | 845 | { |
802 | ph = GNUNET_ATS_performance_init (cfg, | 846 | ph = GNUNET_ATS_performance_init (cfg, |
803 | &ats_perf_mon_cb, | 847 | &ats_perf_mon_cb, |
@@ -807,11 +851,11 @@ testservice_ats (void *cls, | |||
807 | "%s", | 851 | "%s", |
808 | _("Cannot connect to ATS service, exiting...\n")); | 852 | _("Cannot connect to ATS service, exiting...\n")); |
809 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 853 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
810 | &end, | 854 | &end, |
811 | NULL); | 855 | NULL); |
812 | 856 | return; | |
813 | } | 857 | } |
814 | else if (opt_set_pref) | 858 | if (opt_set_pref) |
815 | { | 859 | { |
816 | if (NULL == opt_type_str) | 860 | if (NULL == opt_type_str) |
817 | { | 861 | { |
@@ -860,35 +904,27 @@ testservice_ats (void *cls, | |||
860 | GNUNET_ATS_PREFERENCE_END); | 904 | GNUNET_ATS_PREFERENCE_END); |
861 | 905 | ||
862 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 906 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
863 | &end, | 907 | &end, |
864 | NULL); | 908 | NULL); |
909 | return; | ||
910 | } | ||
911 | if (NULL != cpid_str) | ||
912 | { | ||
913 | ats_ch = GNUNET_ATS_connectivity_init (cfg); | ||
914 | ats_sh = GNUNET_ATS_connectivity_suggest (ats_ch, | ||
915 | &cpid, | ||
916 | 1000); | ||
917 | shutdown_task | ||
918 | = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
919 | &end, | ||
920 | NULL); | ||
921 | return; | ||
865 | } | 922 | } |
866 | ret = 1; | 923 | ret = 1; |
867 | } | 924 | } |
868 | 925 | ||
869 | 926 | ||
870 | /** | 927 | /** |
871 | * Main function that will be run by the scheduler. | ||
872 | * | ||
873 | * @param cls closure | ||
874 | * @param args remaining command-line arguments | ||
875 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
876 | * @param my_cfg configuration | ||
877 | */ | ||
878 | static void | ||
879 | run (void *cls, | ||
880 | char * const *args, | ||
881 | const char *cfgfile, | ||
882 | const struct GNUNET_CONFIGURATION_Handle *my_cfg) | ||
883 | { | ||
884 | cfg = (struct GNUNET_CONFIGURATION_Handle *) my_cfg; | ||
885 | GNUNET_CLIENT_service_test ("ats", cfg, | ||
886 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), | ||
887 | &testservice_ats, (void *) cfg); | ||
888 | } | ||
889 | |||
890 | |||
891 | /** | ||
892 | * The main function. | 928 | * The main function. |
893 | * | 929 | * |
894 | * @param argc number of arguments from the command line | 930 | * @param argc number of arguments from the command line |
@@ -910,37 +946,42 @@ main (int argc, | |||
910 | stat_receive_done = GNUNET_NO; | 946 | stat_receive_done = GNUNET_NO; |
911 | opt_type_str = NULL; | 947 | opt_type_str = NULL; |
912 | 948 | ||
913 | static const struct GNUNET_GETOPT_CommandLineOption options[] = | 949 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
914 | { | 950 | { 'u', "used", NULL, |
915 | { 'u', "used", NULL, | ||
916 | gettext_noop ("get list of active addresses currently used"), 0, | 951 | gettext_noop ("get list of active addresses currently used"), 0, |
917 | &GNUNET_GETOPT_set_one, &opt_list_used }, | 952 | &GNUNET_GETOPT_set_one, &opt_list_used }, |
918 | { 'a', "all", NULL, gettext_noop ("get list of all active addresses"), 0, | 953 | { 'a', "all", NULL, gettext_noop ("get list of all active addresses"), 0, |
919 | &GNUNET_GETOPT_set_one, &opt_list_all }, | 954 | &GNUNET_GETOPT_set_one, &opt_list_all }, |
920 | { 'n', "numeric", NULL, | 955 | { 'C', "connect", "PEER", |
956 | gettext_noop ("connect to PEER"), 1, | ||
957 | &GNUNET_GETOPT_set_string, &cpid_str }, | ||
958 | { 'n', "numeric", NULL, | ||
921 | gettext_noop ("do not resolve IP addresses to hostnames"), 0, | 959 | gettext_noop ("do not resolve IP addresses to hostnames"), 0, |
922 | &GNUNET_GETOPT_set_one, &opt_resolve_addresses_numeric }, | 960 | &GNUNET_GETOPT_set_one, &opt_resolve_addresses_numeric }, |
923 | { 'm', "monitor", NULL, gettext_noop ("monitor mode"), 0, | 961 | { 'm', "monitor", NULL, gettext_noop ("monitor mode"), 0, |
924 | &GNUNET_GETOPT_set_one, &opt_monitor }, | 962 | &GNUNET_GETOPT_set_one, &opt_monitor }, |
925 | { 'p', "preference", NULL, gettext_noop ("set preference for the given peer"), | 963 | { 'p', "preference", NULL, gettext_noop ("set preference for the given peer"), |
926 | 0, &GNUNET_GETOPT_set_one, &opt_set_pref }, | 964 | 0, &GNUNET_GETOPT_set_one, &opt_set_pref }, |
927 | { 'q', "quotas", NULL, gettext_noop ("print all configured quotas"), 0, | 965 | { 'q', "quotas", NULL, gettext_noop ("print all configured quotas"), 0, |
928 | &GNUNET_GETOPT_set_one, &opt_print_quotas }, | 966 | &GNUNET_GETOPT_set_one, &opt_print_quotas }, |
929 | { 'i', "id", "TYPE", gettext_noop ("peer id"), 1, &GNUNET_GETOPT_set_string, | 967 | { 'i', "id", "TYPE", gettext_noop ("peer id"), 1, &GNUNET_GETOPT_set_string, |
930 | &opt_pid_str }, | 968 | &opt_pid_str }, |
931 | { 't', "type", "TYPE", | 969 | { 't', "type", "TYPE", |
932 | gettext_noop ("preference type to set: latency | bandwidth"), 1, | 970 | gettext_noop ("preference type to set: latency | bandwidth"), 1, |
933 | &GNUNET_GETOPT_set_string, &opt_type_str }, | 971 | &GNUNET_GETOPT_set_string, &opt_type_str }, |
934 | { 'k', "value", "VALUE", gettext_noop ("preference value"), 1, | 972 | { 'k', "value", "VALUE", gettext_noop ("preference value"), 1, |
935 | &GNUNET_GETOPT_set_uint, &opt_pref_value }, | 973 | &GNUNET_GETOPT_set_uint, &opt_pref_value }, |
936 | { 'V', "verbose", NULL, | 974 | { 'V', "verbose", NULL, |
937 | gettext_noop ("verbose output (include ATS address properties)"), 0, | 975 | gettext_noop ("verbose output (include ATS address properties)"), 0, |
938 | &GNUNET_GETOPT_set_one, &opt_verbose }, GNUNET_GETOPT_OPTION_END }; | 976 | &GNUNET_GETOPT_set_one, &opt_verbose }, |
977 | GNUNET_GETOPT_OPTION_END | ||
978 | }; | ||
939 | 979 | ||
940 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 980 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
941 | return 2; | 981 | return 2; |
942 | 982 | ||
943 | res = GNUNET_PROGRAM_run (argc, argv, "gnunet-ats", | 983 | res = GNUNET_PROGRAM_run (argc, argv, |
984 | "gnunet-ats", | ||
944 | gettext_noop ("Print information about ATS state"), | 985 | gettext_noop ("Print information about ATS state"), |
945 | options, | 986 | options, |
946 | &run, NULL); | 987 | &run, NULL); |
@@ -952,7 +993,6 @@ main (int argc, | |||
952 | return ret; | 993 | return ret; |
953 | else | 994 | else |
954 | return 1; | 995 | return 1; |
955 | |||
956 | } | 996 | } |
957 | 997 | ||
958 | /* end of gnunet-ats.c */ | 998 | /* end of gnunet-ats.c */ |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index f3cbeb400..5acc2807c 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -190,6 +190,7 @@ typedef void | |||
190 | * @param cb_cls closure for the callback @a cb | 190 | * @param cb_cls closure for the callback @a cb |
191 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or | 191 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or |
192 | * NULL on failure (@a cb will not be called) | 192 | * NULL on failure (@a cb will not be called) |
193 | * @deprecated | ||
193 | */ | 194 | */ |
194 | struct GNUNET_TRANSPORT_TryConnectHandle * | 195 | struct GNUNET_TRANSPORT_TryConnectHandle * |
195 | GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, | 196 | GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, |
@@ -235,6 +236,7 @@ typedef void | |||
235 | * @param cb_cls closure for the callback @a cb | 236 | * @param cb_cls closure for the callback @a cb |
236 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or | 237 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or |
237 | * NULL on failure (@a cb will not be called) | 238 | * NULL on failure (@a cb will not be called) |
239 | * @deprecated use blacklisting API instead! | ||
238 | */ | 240 | */ |
239 | struct GNUNET_TRANSPORT_TryDisconnectHandle * | 241 | struct GNUNET_TRANSPORT_TryDisconnectHandle * |
240 | GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, | 242 | GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 4feb77398..f8d3e26d8 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 46 | #define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Timeout for an operations | 49 | * Timeout for an operation |
50 | */ | 50 | */ |
51 | #define OP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 51 | #define OP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
52 | 52 | ||
@@ -271,14 +271,9 @@ static struct GNUNET_TRANSPORT_Handle *handle; | |||
271 | static struct GNUNET_CONFIGURATION_Handle *cfg; | 271 | static struct GNUNET_CONFIGURATION_Handle *cfg; |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * Try connect handle | 274 | * Blacklisting handle |
275 | */ | 275 | */ |
276 | struct GNUNET_TRANSPORT_TryConnectHandle *tc_handle; | 276 | struct GNUNET_TRANSPORT_Blacklist *blacklist; |
277 | |||
278 | /** | ||
279 | * Try disconnect handle | ||
280 | */ | ||
281 | struct GNUNET_TRANSPORT_TryDisconnectHandle *td_handle; | ||
282 | 277 | ||
283 | /** | 278 | /** |
284 | * Option -s. | 279 | * Option -s. |
@@ -336,14 +331,9 @@ static int monitor_validation; | |||
336 | static int monitor_plugins; | 331 | static int monitor_plugins; |
337 | 332 | ||
338 | /** | 333 | /** |
339 | * Option -C. | ||
340 | */ | ||
341 | static int try_connect; | ||
342 | |||
343 | /** | ||
344 | * Option -D. | 334 | * Option -D. |
345 | */ | 335 | */ |
346 | static int try_disconnect; | 336 | static int do_disconnect; |
347 | 337 | ||
348 | /** | 338 | /** |
349 | * Option -n. | 339 | * Option -n. |
@@ -519,11 +509,6 @@ shutdown_task (void *cls, | |||
519 | GNUNET_SCHEDULER_cancel (op_timeout); | 509 | GNUNET_SCHEDULER_cancel (op_timeout); |
520 | op_timeout = NULL; | 510 | op_timeout = NULL; |
521 | } | 511 | } |
522 | if (NULL != tc_handle) | ||
523 | { | ||
524 | GNUNET_TRANSPORT_try_connect_cancel (tc_handle); | ||
525 | tc_handle = NULL; | ||
526 | } | ||
527 | if (NULL != pic) | 512 | if (NULL != pic) |
528 | { | 513 | { |
529 | GNUNET_TRANSPORT_monitor_peers_cancel (pic); | 514 | GNUNET_TRANSPORT_monitor_peers_cancel (pic); |
@@ -605,17 +590,27 @@ shutdown_task (void *cls, | |||
605 | GNUNET_CONTAINER_multipeermap_destroy (monitored_plugins); | 590 | GNUNET_CONTAINER_multipeermap_destroy (monitored_plugins); |
606 | monitored_plugins = NULL; | 591 | monitored_plugins = NULL; |
607 | } | 592 | } |
593 | if (NULL != blacklist) | ||
594 | { | ||
595 | GNUNET_TRANSPORT_blacklist_cancel (blacklist); | ||
596 | blacklist = NULL; | ||
597 | ret = 0; | ||
598 | } | ||
608 | } | 599 | } |
609 | 600 | ||
610 | 601 | ||
602 | /** | ||
603 | * We are done, shut down. | ||
604 | */ | ||
611 | static void | 605 | static void |
612 | operation_timeout (void *cls, | 606 | operation_timeout (void *cls, |
613 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 607 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
614 | { | 608 | { |
615 | struct PeerResolutionContext *cur; | 609 | struct PeerResolutionContext *cur; |
616 | struct PeerResolutionContext *next; | 610 | struct PeerResolutionContext *next; |
611 | |||
617 | op_timeout = NULL; | 612 | op_timeout = NULL; |
618 | if ((try_connect) || (benchmark_send) || (benchmark_receive)) | 613 | if ((benchmark_send) || (benchmark_receive)) |
619 | { | 614 | { |
620 | FPRINTF (stdout, | 615 | FPRINTF (stdout, |
621 | _("Failed to connect to `%s'\n"), | 616 | _("Failed to connect to `%s'\n"), |
@@ -1108,24 +1103,6 @@ notify_connect (void *cls, | |||
1108 | if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity))) | 1103 | if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity))) |
1109 | return; | 1104 | return; |
1110 | ret = 0; | 1105 | ret = 0; |
1111 | if (try_connect) | ||
1112 | { | ||
1113 | /* all done, terminate instantly */ | ||
1114 | FPRINTF (stdout, _("Successfully connected to `%s'\n"), | ||
1115 | GNUNET_i2s_full (peer)); | ||
1116 | ret = 0; | ||
1117 | |||
1118 | if (NULL != op_timeout) | ||
1119 | { | ||
1120 | GNUNET_SCHEDULER_cancel (op_timeout); | ||
1121 | op_timeout = NULL; | ||
1122 | } | ||
1123 | |||
1124 | if (NULL != end) | ||
1125 | GNUNET_SCHEDULER_cancel (end); | ||
1126 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | ||
1127 | return; | ||
1128 | } | ||
1129 | if (benchmark_send) | 1106 | if (benchmark_send) |
1130 | { | 1107 | { |
1131 | if (NULL != op_timeout) | 1108 | if (NULL != op_timeout) |
@@ -1165,25 +1142,6 @@ notify_disconnect (void *cls, | |||
1165 | if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity))) | 1142 | if (0 != memcmp (&pid, peer, sizeof(struct GNUNET_PeerIdentity))) |
1166 | return; | 1143 | return; |
1167 | 1144 | ||
1168 | if (try_disconnect) | ||
1169 | { | ||
1170 | /* all done, terminate instantly */ | ||
1171 | FPRINTF (stdout, _("Successfully disconnected from `%s'\n"), | ||
1172 | GNUNET_i2s_full (peer)); | ||
1173 | ret = 0; | ||
1174 | |||
1175 | if (NULL != op_timeout) | ||
1176 | { | ||
1177 | GNUNET_SCHEDULER_cancel (op_timeout); | ||
1178 | op_timeout = NULL; | ||
1179 | } | ||
1180 | |||
1181 | if (NULL != end) | ||
1182 | GNUNET_SCHEDULER_cancel (end); | ||
1183 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | ||
1184 | return; | ||
1185 | } | ||
1186 | |||
1187 | if (NULL != th) | 1145 | if (NULL != th) |
1188 | { | 1146 | { |
1189 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); | 1147 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); |
@@ -1425,7 +1383,7 @@ process_peer_string (void *cls, | |||
1425 | op_timeout = NULL; | 1383 | op_timeout = NULL; |
1426 | } | 1384 | } |
1427 | ret = 0; | 1385 | ret = 0; |
1428 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, | 1386 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, |
1429 | NULL); | 1387 | NULL); |
1430 | } | 1388 | } |
1431 | } | 1389 | } |
@@ -1450,7 +1408,7 @@ resolve_peer_address (const struct GNUNET_HELLO_Address *address, | |||
1450 | struct PeerResolutionContext *rc; | 1408 | struct PeerResolutionContext *rc; |
1451 | 1409 | ||
1452 | rc = GNUNET_new (struct PeerResolutionContext); | 1410 | rc = GNUNET_new (struct PeerResolutionContext); |
1453 | GNUNET_CONTAINER_DLL_insert (rc_head, | 1411 | GNUNET_CONTAINER_DLL_insert (rc_head, |
1454 | rc_tail, | 1412 | rc_tail, |
1455 | rc); | 1413 | rc); |
1456 | address_resolutions++; | 1414 | address_resolutions++; |
@@ -1512,12 +1470,12 @@ process_peer_iteration_cb (void *cls, | |||
1512 | address->transport_name); | 1470 | address->transport_name); |
1513 | 1471 | ||
1514 | if (NULL != address) | 1472 | if (NULL != address) |
1515 | resolve_peer_address (address, | 1473 | resolve_peer_address (address, |
1516 | numeric, | 1474 | numeric, |
1517 | state, | 1475 | state, |
1518 | state_timeout); | 1476 | state_timeout); |
1519 | else | 1477 | else |
1520 | print_info (peer, | 1478 | print_info (peer, |
1521 | NULL, | 1479 | NULL, |
1522 | NULL, | 1480 | NULL, |
1523 | state, | 1481 | state, |
@@ -1751,7 +1709,7 @@ process_peer_monitoring_cb (void *cls, | |||
1751 | &operation_timeout, | 1709 | &operation_timeout, |
1752 | NULL); | 1710 | NULL); |
1753 | 1711 | ||
1754 | if (NULL == (m = GNUNET_CONTAINER_multipeermap_get (monitored_peers, | 1712 | if (NULL == (m = GNUNET_CONTAINER_multipeermap_get (monitored_peers, |
1755 | peer))) | 1713 | peer))) |
1756 | { | 1714 | { |
1757 | m = GNUNET_new (struct MonitoredPeer); | 1715 | m = GNUNET_new (struct MonitoredPeer); |
@@ -1770,7 +1728,7 @@ process_peer_monitoring_cb (void *cls, | |||
1770 | return; /* No real change */ | 1728 | return; /* No real change */ |
1771 | } | 1729 | } |
1772 | if ( (m->state == state) && | 1730 | if ( (m->state == state) && |
1773 | (NULL != address) && | 1731 | (NULL != address) && |
1774 | (NULL != m->address) && | 1732 | (NULL != m->address) && |
1775 | (0 == GNUNET_HELLO_address_cmp(m->address, address)) ) | 1733 | (0 == GNUNET_HELLO_address_cmp(m->address, address)) ) |
1776 | return; /* No real change */ | 1734 | return; /* No real change */ |
@@ -1801,73 +1759,23 @@ process_peer_monitoring_cb (void *cls, | |||
1801 | 1759 | ||
1802 | 1760 | ||
1803 | /** | 1761 | /** |
1804 | * Function called with our result of trying to connect to a peer | 1762 | * Function called with the transport service checking if we |
1805 | * using the transport service. Will retry 10 times, and if we still | 1763 | * want to blacklist a peer. Return #GNUNET_SYSERR for the |
1806 | * fail to connect terminate with an error message. | 1764 | * peer that we should disconnect from. |
1807 | * | ||
1808 | * @param cls NULL | ||
1809 | * @param result #GNUNET_OK if we connected to the service | ||
1810 | */ | ||
1811 | static void | ||
1812 | try_connect_cb (void *cls, | ||
1813 | const int result) | ||
1814 | { | ||
1815 | static int retries = 0; | ||
1816 | |||
1817 | tc_handle = NULL; | ||
1818 | if (GNUNET_OK == result) | ||
1819 | return; | ||
1820 | retries++; | ||
1821 | if (retries < 10) | ||
1822 | { | ||
1823 | tc_handle = GNUNET_TRANSPORT_try_connect (handle, | ||
1824 | &pid, | ||
1825 | &try_connect_cb, | ||
1826 | NULL); | ||
1827 | return; | ||
1828 | } | ||
1829 | FPRINTF (stderr, | ||
1830 | "%s", | ||
1831 | _("Failed to send connect request to transport service\n")); | ||
1832 | if (NULL != end) | ||
1833 | GNUNET_SCHEDULER_cancel (end); | ||
1834 | ret = 1; | ||
1835 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | ||
1836 | } | ||
1837 | |||
1838 | |||
1839 | /** | ||
1840 | * Function called with our result of trying to disconnect a peer | ||
1841 | * using the transport service. Will retry 10 times, and if we still | ||
1842 | * fail to disconnect, terminate with an error message. | ||
1843 | * | 1765 | * |
1844 | * @param cls NULL | 1766 | * @param cls NULL |
1845 | * @param result #GNUNET_OK if we connected to the service | 1767 | * @param cpid peer to check blacklisting for |
1768 | * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not | ||
1846 | */ | 1769 | */ |
1847 | static void | 1770 | static int |
1848 | try_disconnect_cb (void *cls, | 1771 | blacklist_cb (void *cls, |
1849 | const int result) | 1772 | const struct GNUNET_PeerIdentity *cpid) |
1850 | { | 1773 | { |
1851 | static int retries = 0; | 1774 | if (0 == memcmp (cpid, |
1852 | 1775 | &pid, | |
1853 | td_handle = NULL; | 1776 | sizeof (struct GNUNET_PeerIdentity))) |
1854 | if (GNUNET_OK == result) | 1777 | return GNUNET_SYSERR; |
1855 | return; | 1778 | return GNUNET_OK; |
1856 | retries++; | ||
1857 | if (retries < 10) | ||
1858 | { | ||
1859 | td_handle = GNUNET_TRANSPORT_try_disconnect (handle, | ||
1860 | &pid, | ||
1861 | &try_disconnect_cb, | ||
1862 | NULL); | ||
1863 | return; | ||
1864 | } | ||
1865 | FPRINTF (stderr, "%s", | ||
1866 | _("Failed to send disconnect request to transport service\n")); | ||
1867 | if (NULL != end) | ||
1868 | GNUNET_SCHEDULER_cancel (end); | ||
1869 | ret = 1; | ||
1870 | end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | ||
1871 | } | 1779 | } |
1872 | 1780 | ||
1873 | 1781 | ||
@@ -1891,24 +1799,27 @@ testservice_task (void *cls, | |||
1891 | return; | 1799 | return; |
1892 | } | 1800 | } |
1893 | 1801 | ||
1894 | if ((NULL != cpid) | 1802 | if ( (NULL != cpid) && |
1895 | && (GNUNET_OK | 1803 | (GNUNET_OK != |
1896 | != GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, strlen (cpid), | 1804 | GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, |
1897 | &pid.public_key))) | 1805 | strlen (cpid), |
1806 | &pid.public_key))) | ||
1898 | { | 1807 | { |
1899 | FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid); | 1808 | FPRINTF (stderr, |
1809 | _("Failed to parse peer identity `%s'\n"), | ||
1810 | cpid); | ||
1900 | return; | 1811 | return; |
1901 | } | 1812 | } |
1902 | 1813 | ||
1903 | counter = benchmark_send + benchmark_receive + iterate_connections | 1814 | counter = benchmark_send + benchmark_receive + iterate_connections |
1904 | + monitor_connections + monitor_connects + try_connect + try_disconnect + | 1815 | + monitor_connections + monitor_connects + do_disconnect + |
1905 | + iterate_validation + monitor_validation + monitor_plugins; | 1816 | + iterate_validation + monitor_validation + monitor_plugins; |
1906 | 1817 | ||
1907 | if (1 < counter) | 1818 | if (1 < counter) |
1908 | { | 1819 | { |
1909 | FPRINTF (stderr, | 1820 | FPRINTF (stderr, |
1910 | _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"), | 1821 | _("Multiple operations given. Please choose only one operation: %s, %s, %s, %s, %s, %s %s\n"), |
1911 | "connect", "benchmark send", "benchmark receive", "information", | 1822 | "disconnect", "benchmark send", "benchmark receive", "information", |
1912 | "monitor", "events", "plugins"); | 1823 | "monitor", "events", "plugins"); |
1913 | return; | 1824 | return; |
1914 | } | 1825 | } |
@@ -1916,71 +1827,35 @@ testservice_task (void *cls, | |||
1916 | { | 1827 | { |
1917 | FPRINTF (stderr, | 1828 | FPRINTF (stderr, |
1918 | _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"), | 1829 | _("No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n"), |
1919 | "connect", "benchmark send", "benchmark receive", "information", | 1830 | "disconnect", "benchmark send", "benchmark receive", "information", |
1920 | "monitor", "events", "plugins"); | 1831 | "monitor", "events", "plugins"); |
1921 | return; | 1832 | return; |
1922 | } | 1833 | } |
1923 | 1834 | ||
1924 | if (try_connect) /* -C: Connect to peer */ | 1835 | if (do_disconnect) /* -D: Disconnect from peer */ |
1925 | { | 1836 | { |
1926 | if (NULL == cpid) | 1837 | if (NULL == cpid) |
1927 | { | 1838 | { |
1928 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | 1839 | FPRINTF (stderr, |
1929 | "-C", "-p"); | 1840 | _("Option `%s' makes no sense without option `%s'.\n"), |
1930 | ret = 1; | 1841 | "-D", "-p"); |
1931 | return; | ||
1932 | } | ||
1933 | handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, | ||
1934 | ¬ify_connect, ¬ify_disconnect); | ||
1935 | if (NULL == handle) | ||
1936 | { | ||
1937 | FPRINTF (stderr, "%s", _("Failed to connect to transport service\n")); | ||
1938 | ret = 1; | ||
1939 | return; | ||
1940 | } | ||
1941 | tc_handle = GNUNET_TRANSPORT_try_connect (handle, &pid, try_connect_cb, | ||
1942 | NULL); | ||
1943 | if (NULL == tc_handle) | ||
1944 | { | ||
1945 | FPRINTF (stderr, "%s", | ||
1946 | _("Failed to send request to transport service\n")); | ||
1947 | ret = 1; | ||
1948 | return; | ||
1949 | } | ||
1950 | op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, | ||
1951 | NULL); | ||
1952 | |||
1953 | } | ||
1954 | else if (try_disconnect) /* -D: Disconnect from peer */ | ||
1955 | { | ||
1956 | if (NULL == cpid) | ||
1957 | { | ||
1958 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | ||
1959 | "-D", "-p"); | ||
1960 | ret = 1; | ||
1961 | return; | ||
1962 | } | ||
1963 | handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, | ||
1964 | ¬ify_connect, ¬ify_disconnect); | ||
1965 | if (NULL == handle) | ||
1966 | { | ||
1967 | FPRINTF (stderr, "%s", _("Failed to connect to transport service\n")); | ||
1968 | ret = 1; | 1842 | ret = 1; |
1969 | return; | 1843 | return; |
1970 | } | 1844 | } |
1971 | td_handle = GNUNET_TRANSPORT_try_disconnect (handle, &pid, | 1845 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, |
1972 | &try_disconnect_cb, | 1846 | &blacklist_cb, |
1973 | NULL); | 1847 | NULL); |
1974 | if (NULL == td_handle) | 1848 | if (NULL == blacklist) |
1975 | { | 1849 | { |
1976 | FPRINTF (stderr, "%s", | 1850 | FPRINTF (stderr, |
1977 | _("Failed to send request to transport service\n")); | 1851 | "%s", |
1852 | _("Failed to connect to transport service for disconnection\n")); | ||
1978 | ret = 1; | 1853 | ret = 1; |
1979 | return; | 1854 | return; |
1980 | } | 1855 | } |
1981 | op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, | 1856 | FPRINTF (stdout, |
1982 | NULL); | 1857 | "%s", |
1983 | 1858 | _("Blacklisting request in place, stop with CTRL-C\n")); | |
1984 | } | 1859 | } |
1985 | else if (benchmark_send) /* -s: Benchmark sending */ | 1860 | else if (benchmark_send) /* -s: Benchmark sending */ |
1986 | { | 1861 | { |
@@ -1991,7 +1866,9 @@ testservice_task (void *cls, | |||
1991 | ret = 1; | 1866 | ret = 1; |
1992 | return; | 1867 | return; |
1993 | } | 1868 | } |
1994 | handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, | 1869 | handle = GNUNET_TRANSPORT_connect (cfg, |
1870 | NULL, | ||
1871 | NULL, | ||
1995 | ¬ify_receive, | 1872 | ¬ify_receive, |
1996 | ¬ify_connect, | 1873 | ¬ify_connect, |
1997 | ¬ify_disconnect); | 1874 | ¬ify_disconnect); |
@@ -2001,17 +1878,6 @@ testservice_task (void *cls, | |||
2001 | ret = 1; | 1878 | ret = 1; |
2002 | return; | 1879 | return; |
2003 | } | 1880 | } |
2004 | tc_handle = GNUNET_TRANSPORT_try_connect (handle, | ||
2005 | &pid, | ||
2006 | &try_connect_cb, | ||
2007 | NULL); | ||
2008 | if (NULL == tc_handle) | ||
2009 | { | ||
2010 | FPRINTF (stderr, "%s", | ||
2011 | _("Failed to send request to transport service\n")); | ||
2012 | ret = 1; | ||
2013 | return; | ||
2014 | } | ||
2015 | start_time = GNUNET_TIME_absolute_get (); | 1881 | start_time = GNUNET_TIME_absolute_get (); |
2016 | op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, | 1882 | op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, |
2017 | &operation_timeout, | 1883 | &operation_timeout, |
@@ -2019,8 +1885,12 @@ testservice_task (void *cls, | |||
2019 | } | 1885 | } |
2020 | else if (benchmark_receive) /* -b: Benchmark receiving */ | 1886 | else if (benchmark_receive) /* -b: Benchmark receiving */ |
2021 | { | 1887 | { |
2022 | handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, NULL, | 1888 | handle = GNUNET_TRANSPORT_connect (cfg, |
2023 | NULL); | 1889 | NULL, |
1890 | NULL, | ||
1891 | ¬ify_receive, | ||
1892 | NULL, | ||
1893 | NULL); | ||
2024 | if (NULL == handle) | 1894 | if (NULL == handle) |
2025 | { | 1895 | { |
2026 | FPRINTF (stderr, "%s", _("Failed to connect to transport service\n")); | 1896 | FPRINTF (stderr, "%s", _("Failed to connect to transport service\n")); |
@@ -2037,17 +1907,18 @@ testservice_task (void *cls, | |||
2037 | address_resolution_in_progress = GNUNET_YES; | 1907 | address_resolution_in_progress = GNUNET_YES; |
2038 | pic = GNUNET_TRANSPORT_monitor_peers (cfg, (NULL == cpid) ? NULL : &pid, | 1908 | pic = GNUNET_TRANSPORT_monitor_peers (cfg, (NULL == cpid) ? NULL : &pid, |
2039 | GNUNET_YES, TIMEOUT, &process_peer_iteration_cb, (void *) cfg); | 1909 | GNUNET_YES, TIMEOUT, &process_peer_iteration_cb, (void *) cfg); |
2040 | op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, &operation_timeout, | 1910 | op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT, |
2041 | NULL); | 1911 | &operation_timeout, |
1912 | NULL); | ||
2042 | } | 1913 | } |
2043 | else if (monitor_connections) /* -m: List information about peers continuously */ | 1914 | else if (monitor_connections) /* -m: List information about peers continuously */ |
2044 | { | 1915 | { |
2045 | monitored_peers = GNUNET_CONTAINER_multipeermap_create (10, | 1916 | monitored_peers = GNUNET_CONTAINER_multipeermap_create (10, |
2046 | GNUNET_NO); | 1917 | GNUNET_NO); |
2047 | address_resolution_in_progress = GNUNET_YES; | 1918 | address_resolution_in_progress = GNUNET_YES; |
2048 | pic = GNUNET_TRANSPORT_monitor_peers (cfg, | 1919 | pic = GNUNET_TRANSPORT_monitor_peers (cfg, |
2049 | (NULL == cpid) ? NULL : &pid, | 1920 | (NULL == cpid) ? NULL : &pid, |
2050 | GNUNET_NO, | 1921 | GNUNET_NO, |
2051 | TIMEOUT, | 1922 | TIMEOUT, |
2052 | &process_peer_monitoring_cb, NULL); | 1923 | &process_peer_monitoring_cb, NULL); |
2053 | } | 1924 | } |
@@ -2135,12 +2006,9 @@ main (int argc, char * const *argv) | |||
2135 | { 'b', "benchmark", NULL, | 2006 | { 'b', "benchmark", NULL, |
2136 | gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"), | 2007 | gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"), |
2137 | 0, &GNUNET_GETOPT_set_one, &benchmark_receive }, | 2008 | 0, &GNUNET_GETOPT_set_one, &benchmark_receive }, |
2138 | { 'C', "connect", | ||
2139 | NULL, gettext_noop ("connect to a peer"), 0, | ||
2140 | &GNUNET_GETOPT_set_one, &try_connect }, | ||
2141 | { 'D', "disconnect", | 2009 | { 'D', "disconnect", |
2142 | NULL, gettext_noop ("disconnect to a peer"), 0, | 2010 | NULL, gettext_noop ("disconnect to a peer"), 0, |
2143 | &GNUNET_GETOPT_set_one, &try_disconnect }, | 2011 | &GNUNET_GETOPT_set_one, &do_disconnect }, |
2144 | { 'd', "validation", NULL, | 2012 | { 'd', "validation", NULL, |
2145 | gettext_noop ("print information for all pending validations "), | 2013 | gettext_noop ("print information for all pending validations "), |
2146 | 0, &GNUNET_GETOPT_set_one, &iterate_validation }, | 2014 | 0, &GNUNET_GETOPT_set_one, &iterate_validation }, |