diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/hostlist/gnunet-daemon-hostlist.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/hostlist/gnunet-daemon-hostlist.c')
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index c49aec765..9d47dfa9c 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -128,8 +128,7 @@ struct GNUNET_HOSTLIST_ADV_Message | |||
128 | static struct GNUNET_PeerIdentity me; | 128 | static struct GNUNET_PeerIdentity me; |
129 | 129 | ||
130 | static void | 130 | static void |
131 | core_init (void *cls, | 131 | core_init (void *cls, struct GNUNET_CORE_Handle *server, |
132 | struct GNUNET_CORE_Handle *server, | ||
133 | const struct GNUNET_PeerIdentity *my_identity, | 132 | const struct GNUNET_PeerIdentity *my_identity, |
134 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) | 133 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
135 | { | 134 | { |
@@ -140,8 +139,7 @@ core_init (void *cls, | |||
140 | * Core handler for p2p hostlist advertisements | 139 | * Core handler for p2p hostlist advertisements |
141 | */ | 140 | */ |
142 | static int | 141 | static int |
143 | advertisement_handler (void *cls, | 142 | advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
144 | const struct GNUNET_PeerIdentity *peer, | ||
145 | const struct GNUNET_MessageHeader *message, | 143 | const struct GNUNET_MessageHeader *message, |
146 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 144 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
147 | { | 145 | { |
@@ -158,9 +156,7 @@ advertisement_handler (void *cls, | |||
158 | * @param atsi performance data | 156 | * @param atsi performance data |
159 | */ | 157 | */ |
160 | static void | 158 | static void |
161 | connect_handler (void *cls, | 159 | connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
162 | const struct | ||
163 | GNUNET_PeerIdentity *peer, | ||
164 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 160 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
165 | { | 161 | { |
166 | if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity))) | 162 | if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity))) |
@@ -236,9 +232,8 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
236 | * @param cfg configuration | 232 | * @param cfg configuration |
237 | */ | 233 | */ |
238 | static void | 234 | static void |
239 | run (void *cls, | 235 | run (void *cls, char *const *args, const char *cfgfile, |
240 | char *const *args, | 236 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
241 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
242 | { | 237 | { |
243 | static const struct GNUNET_CORE_MessageHandler learn_handlers[] = { | 238 | static const struct GNUNET_CORE_MessageHandler learn_handlers[] = { |
244 | {&advertisement_handler, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, 0}, | 239 | {&advertisement_handler, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, 0}, |
@@ -263,20 +258,16 @@ run (void *cls, | |||
263 | 258 | ||
264 | stats = GNUNET_STATISTICS_create ("hostlist", cfg); | 259 | stats = GNUNET_STATISTICS_create ("hostlist", cfg); |
265 | 260 | ||
266 | core = GNUNET_CORE_connect (cfg, | 261 | core = |
267 | 1, | 262 | GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_handler, |
268 | NULL, | 263 | &disconnect_handler, NULL, NULL, GNUNET_NO, NULL, |
269 | &core_init, | 264 | GNUNET_NO, |
270 | &connect_handler, &disconnect_handler, NULL, | 265 | learning ? learn_handlers : no_learn_handlers); |
271 | NULL, GNUNET_NO, | ||
272 | NULL, GNUNET_NO, | ||
273 | learning ? learn_handlers : no_learn_handlers); | ||
274 | 266 | ||
275 | if (bootstrapping) | 267 | if (bootstrapping) |
276 | { | 268 | { |
277 | GNUNET_HOSTLIST_client_start (cfg, stats, | 269 | GNUNET_HOSTLIST_client_start (cfg, stats, &client_ch, &client_dh, |
278 | &client_ch, &client_dh, &client_adv_handler, | 270 | &client_adv_handler, learning); |
279 | learning); | ||
280 | } | 271 | } |
281 | 272 | ||
282 | #if HAVE_MHD | 273 | #if HAVE_MHD |
@@ -286,8 +277,8 @@ run (void *cls, | |||
286 | advertising); | 277 | advertising); |
287 | } | 278 | } |
288 | #endif | 279 | #endif |
289 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 280 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task, |
290 | &cleaning_task, NULL); | 281 | NULL); |
291 | 282 | ||
292 | if (NULL == core) | 283 | if (NULL == core) |
293 | { | 284 | { |
@@ -333,12 +324,11 @@ main (int argc, char *const *argv) | |||
333 | int ret; | 324 | int ret; |
334 | 325 | ||
335 | GNUNET_log_setup ("hostlist", "WARNING", NULL); | 326 | GNUNET_log_setup ("hostlist", "WARNING", NULL); |
336 | ret = (GNUNET_OK == | 327 | ret = |
337 | GNUNET_PROGRAM_run (argc, | 328 | (GNUNET_OK == |
338 | argv, | 329 | GNUNET_PROGRAM_run (argc, argv, "hostlist", |
339 | "hostlist", | 330 | _("GNUnet hostlist server and client"), options, |
340 | _("GNUnet hostlist server and client"), | 331 | &run, NULL)) ? 0 : 1; |
341 | options, &run, NULL)) ? 0 : 1; | ||
342 | 332 | ||
343 | return ret; | 333 | return ret; |
344 | } | 334 | } |