aboutsummaryrefslogtreecommitdiff
path: root/src/nse/gnunet-nse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nse/gnunet-nse.c')
-rw-r--r--src/nse/gnunet-nse.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/nse/gnunet-nse.c b/src/nse/gnunet-nse.c
index bf2fe11c3..c8ffa152e 100644
--- a/src/nse/gnunet-nse.c
+++ b/src/nse/gnunet-nse.c
@@ -46,6 +46,7 @@ static int status;
46static void 46static void
47do_shutdown (void *cls) 47do_shutdown (void *cls)
48{ 48{
49 (void) cls;
49 if (NULL != nse) 50 if (NULL != nse)
50 { 51 {
51 GNUNET_NSE_disconnect (nse); 52 GNUNET_NSE_disconnect (nse);
@@ -65,12 +66,14 @@ do_shutdown (void *cls)
65 */ 66 */
66static void 67static void
67handle_estimate (void *cls, 68handle_estimate (void *cls,
68 struct GNUNET_TIME_Absolute timestamp, 69 struct GNUNET_TIME_Absolute timestamp,
69 double estimate, 70 double estimate,
70 double std_dev) 71 double std_dev)
71{ 72{
73 (void) cls;
72 status = 0; 74 status = 0;
73 FPRINTF (stdout, "%llu %f %f %f\n", 75 FPRINTF (stdout,
76 "%llu %f %f %f\n",
74 (unsigned long long) timestamp.abs_value_us, 77 (unsigned long long) timestamp.abs_value_us,
75 GNUNET_NSE_log_estimate_to_n (estimate), 78 GNUNET_NSE_log_estimate_to_n (estimate),
76 estimate, 79 estimate,
@@ -92,11 +95,11 @@ run (void *cls,
92 const char *cfgfile, 95 const char *cfgfile,
93 const struct GNUNET_CONFIGURATION_Handle *cfg) 96 const struct GNUNET_CONFIGURATION_Handle *cfg)
94{ 97{
95 nse = GNUNET_NSE_connect (cfg, 98 (void) cls;
96 &handle_estimate, 99 (void) args;
97 NULL); 100 (void) cfgfile;
98 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, 101 nse = GNUNET_NSE_connect (cfg, &handle_estimate, NULL);
99 NULL); 102 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
100} 103}
101 104
102 105
@@ -106,22 +109,21 @@ run (void *cls,
106 * @return 0 on success 109 * @return 0 on success
107 */ 110 */
108int 111int
109main (int argc, 112main (int argc, char *const *argv)
110 char *const *argv)
111{ 113{
112 static struct GNUNET_GETOPT_CommandLineOption options[] = { 114 static struct GNUNET_GETOPT_CommandLineOption options[] = {
113 GNUNET_GETOPT_OPTION_END 115 GNUNET_GETOPT_OPTION_END};
114 };
115 116
116 status = 1; 117 status = 1;
117 if (GNUNET_OK != 118 if (GNUNET_OK !=
118 GNUNET_PROGRAM_run (argc, 119 GNUNET_PROGRAM_run (argc,
119 argv, 120 argv,
120 "gnunet-nse", 121 "gnunet-nse",
121 gettext_noop 122 gettext_noop (
122 ("Show network size estimates from NSE service."), 123 "Show network size estimates from NSE service."),
123 options, 124 options,
124 &run, NULL)) 125 &run,
126 NULL))
125 return 2; 127 return 2;
126 return status; 128 return status;
127} 129}