diff options
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 255 |
1 files changed, 115 insertions, 140 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 5ea1bb7c1..4d12b8bfd 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -162,14 +162,12 @@ static struct GNUNET_PeerIdentity my_id; | |||
162 | * @param tc task context | 162 | * @param tc task context |
163 | */ | 163 | */ |
164 | static void | 164 | static void |
165 | age_cover_counters (void *cls, | 165 | age_cover_counters (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
166 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
167 | { | 166 | { |
168 | GSF_cover_content_count = (GSF_cover_content_count * 15) / 16; | 167 | GSF_cover_content_count = (GSF_cover_content_count * 15) / 16; |
169 | GSF_cover_query_count = (GSF_cover_query_count * 15) / 16; | 168 | GSF_cover_query_count = (GSF_cover_query_count * 15) / 16; |
170 | cover_age_task = GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, | 169 | cover_age_task = GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, |
171 | &age_cover_counters, | 170 | &age_cover_counters, NULL); |
172 | NULL); | ||
173 | } | 171 | } |
174 | 172 | ||
175 | 173 | ||
@@ -186,8 +184,7 @@ GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start) | |||
186 | struct GNUNET_TIME_Relative delay; | 184 | struct GNUNET_TIME_Relative delay; |
187 | 185 | ||
188 | delay = GNUNET_TIME_absolute_get_duration (start); | 186 | delay = GNUNET_TIME_absolute_get_duration (start); |
189 | GNUNET_LOAD_update (datastore_get_load, | 187 | GNUNET_LOAD_update (datastore_get_load, delay.rel_value); |
190 | delay.rel_value); | ||
191 | } | 188 | } |
192 | 189 | ||
193 | 190 | ||
@@ -207,9 +204,9 @@ GSF_test_get_load_too_high_ (uint32_t priority) | |||
207 | 204 | ||
208 | ld = GNUNET_LOAD_get_load (datastore_get_load); | 205 | ld = GNUNET_LOAD_get_load (datastore_get_load); |
209 | if (ld < 1) | 206 | if (ld < 1) |
210 | return GNUNET_SYSERR; | 207 | return GNUNET_SYSERR; |
211 | if (ld <= priority) | 208 | if (ld <= priority) |
212 | return GNUNET_NO; | 209 | return GNUNET_NO; |
213 | return GNUNET_YES; | 210 | return GNUNET_YES; |
214 | } | 211 | } |
215 | 212 | ||
@@ -227,18 +224,18 @@ GSF_test_get_load_too_high_ (uint32_t priority) | |||
227 | */ | 224 | */ |
228 | static int | 225 | static int |
229 | handle_p2p_put (void *cls, | 226 | handle_p2p_put (void *cls, |
230 | const struct GNUNET_PeerIdentity *other, | 227 | const struct GNUNET_PeerIdentity *other, |
231 | const struct GNUNET_MessageHeader *message, | 228 | const struct GNUNET_MessageHeader *message, |
232 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 229 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
233 | { | 230 | { |
234 | struct GSF_ConnectedPeer *cp; | 231 | struct GSF_ConnectedPeer *cp; |
235 | 232 | ||
236 | cp = GSF_peer_get_ (other); | 233 | cp = GSF_peer_get_ (other); |
237 | if (NULL == cp) | 234 | if (NULL == cp) |
238 | { | 235 | { |
239 | GNUNET_break (0); | 236 | GNUNET_break (0); |
240 | return GNUNET_OK; | 237 | return GNUNET_OK; |
241 | } | 238 | } |
242 | GSF_cover_content_count++; | 239 | GSF_cover_content_count++; |
243 | return GSF_handle_p2p_content_ (cp, message); | 240 | return GSF_handle_p2p_content_ (cp, message); |
244 | } | 241 | } |
@@ -255,9 +252,9 @@ handle_p2p_put (void *cls, | |||
255 | */ | 252 | */ |
256 | static void | 253 | static void |
257 | consider_request_for_forwarding (void *cls, | 254 | consider_request_for_forwarding (void *cls, |
258 | const struct GNUNET_PeerIdentity *peer, | 255 | const struct GNUNET_PeerIdentity *peer, |
259 | struct GSF_ConnectedPeer *cp, | 256 | struct GSF_ConnectedPeer *cp, |
260 | const struct GSF_PeerPerformanceData *ppd) | 257 | const struct GSF_PeerPerformanceData *ppd) |
261 | { | 258 | { |
262 | struct GSF_PendingRequest *pr = cls; | 259 | struct GSF_PendingRequest *pr = cls; |
263 | 260 | ||
@@ -277,13 +274,12 @@ consider_request_for_forwarding (void *cls, | |||
277 | */ | 274 | */ |
278 | static void | 275 | static void |
279 | consider_forwarding (void *cls, | 276 | consider_forwarding (void *cls, |
280 | struct GSF_PendingRequest *pr, | 277 | struct GSF_PendingRequest *pr, |
281 | enum GNUNET_BLOCK_EvaluationResult result) | 278 | enum GNUNET_BLOCK_EvaluationResult result) |
282 | { | 279 | { |
283 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) | 280 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) |
284 | return; /* we're done... */ | 281 | return; /* we're done... */ |
285 | GSF_iterate_connected_peers_ (&consider_request_for_forwarding, | 282 | GSF_iterate_connected_peers_ (&consider_request_for_forwarding, pr); |
286 | pr); | ||
287 | } | 283 | } |
288 | 284 | ||
289 | 285 | ||
@@ -300,18 +296,16 @@ consider_forwarding (void *cls, | |||
300 | */ | 296 | */ |
301 | static int | 297 | static int |
302 | handle_p2p_get (void *cls, | 298 | handle_p2p_get (void *cls, |
303 | const struct GNUNET_PeerIdentity *other, | 299 | const struct GNUNET_PeerIdentity *other, |
304 | const struct GNUNET_MessageHeader *message, | 300 | const struct GNUNET_MessageHeader *message, |
305 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 301 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
306 | { | 302 | { |
307 | struct GSF_PendingRequest *pr; | 303 | struct GSF_PendingRequest *pr; |
308 | 304 | ||
309 | pr = GSF_handle_p2p_query_ (other, message); | 305 | pr = GSF_handle_p2p_query_ (other, message); |
310 | if (NULL == pr) | 306 | if (NULL == pr) |
311 | return GNUNET_SYSERR; | 307 | return GNUNET_SYSERR; |
312 | GSF_local_lookup_ (pr, | 308 | GSF_local_lookup_ (pr, &consider_forwarding, NULL); |
313 | &consider_forwarding, | ||
314 | NULL); | ||
315 | return GNUNET_OK; | 309 | return GNUNET_OK; |
316 | } | 310 | } |
317 | 311 | ||
@@ -328,8 +322,8 @@ handle_p2p_get (void *cls, | |||
328 | */ | 322 | */ |
329 | static void | 323 | static void |
330 | start_p2p_processing (void *cls, | 324 | start_p2p_processing (void *cls, |
331 | struct GSF_PendingRequest *pr, | 325 | struct GSF_PendingRequest *pr, |
332 | enum GNUNET_BLOCK_EvaluationResult result) | 326 | enum GNUNET_BLOCK_EvaluationResult result) |
333 | { | 327 | { |
334 | struct GNUNET_SERVER_Client *client = cls; | 328 | struct GNUNET_SERVER_Client *client = cls; |
335 | struct GSF_PendingRequestData *prd; | 329 | struct GSF_PendingRequestData *prd; |
@@ -337,19 +331,17 @@ start_p2p_processing (void *cls, | |||
337 | prd = GSF_pending_request_get_data_ (pr); | 331 | prd = GSF_pending_request_get_data_ (pr); |
338 | #if DEBUG_FS_CLIENT | 332 | #if DEBUG_FS_CLIENT |
339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 333 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
340 | "Finished database lookup for local request `%s' with result %d\n", | 334 | "Finished database lookup for local request `%s' with result %d\n", |
341 | GNUNET_h2s (&prd->query), | 335 | GNUNET_h2s (&prd->query), result); |
342 | result); | ||
343 | #endif | 336 | #endif |
344 | GNUNET_SERVER_receive_done (client, | 337 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
345 | GNUNET_OK); | ||
346 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) | 338 | if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) |
347 | return; /* we're done, 'pr' was already destroyed... */ | 339 | return; /* we're done, 'pr' was already destroyed... */ |
348 | if (0 != (GSF_PRO_LOCAL_ONLY & prd->options) ) | 340 | if (0 != (GSF_PRO_LOCAL_ONLY & prd->options)) |
349 | { | 341 | { |
350 | GSF_pending_request_cancel_ (pr, GNUNET_YES); | 342 | GSF_pending_request_cancel_ (pr, GNUNET_YES); |
351 | return; | 343 | return; |
352 | } | 344 | } |
353 | GSF_dht_lookup_ (pr); | 345 | GSF_dht_lookup_ (pr); |
354 | consider_forwarding (NULL, pr, result); | 346 | consider_forwarding (NULL, pr, result); |
355 | } | 347 | } |
@@ -364,20 +356,18 @@ start_p2p_processing (void *cls, | |||
364 | */ | 356 | */ |
365 | static void | 357 | static void |
366 | handle_start_search (void *cls, | 358 | handle_start_search (void *cls, |
367 | struct GNUNET_SERVER_Client *client, | 359 | struct GNUNET_SERVER_Client *client, |
368 | const struct GNUNET_MessageHeader *message) | 360 | const struct GNUNET_MessageHeader *message) |
369 | { | 361 | { |
370 | struct GSF_PendingRequest *pr; | 362 | struct GSF_PendingRequest *pr; |
371 | 363 | ||
372 | pr = GSF_local_client_start_search_handler_ (client, message); | 364 | pr = GSF_local_client_start_search_handler_ (client, message); |
373 | if (NULL == pr) | 365 | if (NULL == pr) |
374 | { | 366 | { |
375 | /* GNUNET_SERVER_receive_done was already called! */ | 367 | /* GNUNET_SERVER_receive_done was already called! */ |
376 | return; | 368 | return; |
377 | } | 369 | } |
378 | GSF_local_lookup_ (pr, | 370 | GSF_local_lookup_ (pr, &start_p2p_processing, client); |
379 | &start_p2p_processing, | ||
380 | client); | ||
381 | } | 371 | } |
382 | 372 | ||
383 | 373 | ||
@@ -388,14 +378,13 @@ handle_start_search (void *cls, | |||
388 | * @param tc unused | 378 | * @param tc unused |
389 | */ | 379 | */ |
390 | static void | 380 | static void |
391 | shutdown_task (void *cls, | 381 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
392 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
393 | { | 382 | { |
394 | if (NULL != GSF_core) | 383 | if (NULL != GSF_core) |
395 | { | 384 | { |
396 | GNUNET_CORE_disconnect (GSF_core); | 385 | GNUNET_CORE_disconnect (GSF_core); |
397 | GSF_core = NULL; | 386 | GSF_core = NULL; |
398 | } | 387 | } |
399 | GSF_put_done_ (); | 388 | GSF_put_done_ (); |
400 | GSF_push_done_ (); | 389 | GSF_push_done_ (); |
401 | GSF_pending_request_done_ (); | 390 | GSF_pending_request_done_ (); |
@@ -412,10 +401,10 @@ shutdown_task (void *cls, | |||
412 | GNUNET_STATISTICS_destroy (GSF_stats, GNUNET_NO); | 401 | GNUNET_STATISTICS_destroy (GSF_stats, GNUNET_NO); |
413 | GSF_stats = NULL; | 402 | GSF_stats = NULL; |
414 | if (GNUNET_SCHEDULER_NO_TASK != cover_age_task) | 403 | if (GNUNET_SCHEDULER_NO_TASK != cover_age_task) |
415 | { | 404 | { |
416 | GNUNET_SCHEDULER_cancel (cover_age_task); | 405 | GNUNET_SCHEDULER_cancel (cover_age_task); |
417 | cover_age_task = GNUNET_SCHEDULER_NO_TASK; | 406 | cover_age_task = GNUNET_SCHEDULER_NO_TASK; |
418 | } | 407 | } |
419 | GNUNET_FS_indexing_done (); | 408 | GNUNET_FS_indexing_done (); |
420 | GNUNET_LOAD_value_free (datastore_get_load); | 409 | GNUNET_LOAD_value_free (datastore_get_load); |
421 | datastore_get_load = NULL; | 410 | datastore_get_load = NULL; |
@@ -436,11 +425,11 @@ shutdown_task (void *cls, | |||
436 | */ | 425 | */ |
437 | static int | 426 | static int |
438 | consider_peer_for_forwarding (void *cls, | 427 | consider_peer_for_forwarding (void *cls, |
439 | const GNUNET_HashCode *key, | 428 | const GNUNET_HashCode * key, |
440 | struct GSF_PendingRequest *pr) | 429 | struct GSF_PendingRequest *pr) |
441 | { | 430 | { |
442 | struct GSF_ConnectedPeer *cp = cls; | 431 | struct GSF_ConnectedPeer *cp = cls; |
443 | 432 | ||
444 | GSF_plan_add_ (cp, pr); | 433 | GSF_plan_add_ (cp, pr); |
445 | return GNUNET_YES; | 434 | return GNUNET_YES; |
446 | } | 435 | } |
@@ -453,20 +442,19 @@ consider_peer_for_forwarding (void *cls, | |||
453 | * @param peer peer identity this notification is about | 442 | * @param peer peer identity this notification is about |
454 | * @param atsi performance information | 443 | * @param atsi performance information |
455 | */ | 444 | */ |
456 | static void | 445 | static void |
457 | peer_connect_handler (void *cls, | 446 | peer_connect_handler (void *cls, |
458 | const struct GNUNET_PeerIdentity *peer, | 447 | const struct GNUNET_PeerIdentity *peer, |
459 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 448 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
460 | { | 449 | { |
461 | struct GSF_ConnectedPeer *cp; | 450 | struct GSF_ConnectedPeer *cp; |
462 | 451 | ||
463 | if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity))) | 452 | if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity))) |
464 | return; | 453 | return; |
465 | cp = GSF_peer_connect_handler_ (peer, atsi); | 454 | cp = GSF_peer_connect_handler_ (peer, atsi); |
466 | if (NULL == cp) | 455 | if (NULL == cp) |
467 | return; | 456 | return; |
468 | GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, | 457 | GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, cp); |
469 | cp); | ||
470 | } | 458 | } |
471 | 459 | ||
472 | 460 | ||
@@ -484,12 +472,10 @@ peer_connect_handler (void *cls, | |||
484 | */ | 472 | */ |
485 | static void | 473 | static void |
486 | peer_init_handler (void *cls, | 474 | peer_init_handler (void *cls, |
487 | struct GNUNET_CORE_Handle * server, | 475 | struct GNUNET_CORE_Handle *server, |
488 | const struct GNUNET_PeerIdentity * | 476 | const struct GNUNET_PeerIdentity *my_identity, |
489 | my_identity, | 477 | const struct |
490 | const struct | 478 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
491 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded * | ||
492 | publicKey) | ||
493 | { | 479 | { |
494 | my_id = *my_identity; | 480 | my_id = *my_identity; |
495 | } | 481 | } |
@@ -503,59 +489,53 @@ peer_init_handler (void *cls, | |||
503 | */ | 489 | */ |
504 | static int | 490 | static int |
505 | main_init (struct GNUNET_SERVER_Handle *server, | 491 | main_init (struct GNUNET_SERVER_Handle *server, |
506 | const struct GNUNET_CONFIGURATION_Handle *c) | 492 | const struct GNUNET_CONFIGURATION_Handle *c) |
507 | { | 493 | { |
508 | static const struct GNUNET_CORE_MessageHandler p2p_handlers[] = | 494 | static const struct GNUNET_CORE_MessageHandler p2p_handlers[] = { |
509 | { | 495 | {&handle_p2p_get, |
510 | { &handle_p2p_get, | 496 | GNUNET_MESSAGE_TYPE_FS_GET, 0}, |
511 | GNUNET_MESSAGE_TYPE_FS_GET, 0 }, | 497 | {&handle_p2p_put, |
512 | { &handle_p2p_put, | 498 | GNUNET_MESSAGE_TYPE_FS_PUT, 0}, |
513 | GNUNET_MESSAGE_TYPE_FS_PUT, 0 }, | 499 | {&GSF_handle_p2p_migration_stop_, |
514 | { &GSF_handle_p2p_migration_stop_, | 500 | GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP, |
515 | GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP, | 501 | sizeof (struct MigrationStopMessage)}, |
516 | sizeof (struct MigrationStopMessage) }, | 502 | {NULL, 0, 0} |
517 | { NULL, 0, 0 } | 503 | }; |
518 | }; | ||
519 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 504 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
520 | {&GNUNET_FS_handle_index_start, NULL, | 505 | {&GNUNET_FS_handle_index_start, NULL, |
521 | GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0}, | 506 | GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0}, |
522 | {&GNUNET_FS_handle_index_list_get, NULL, | 507 | {&GNUNET_FS_handle_index_list_get, NULL, |
523 | GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, sizeof(struct GNUNET_MessageHeader) }, | 508 | GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, |
524 | {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX, | 509 | sizeof (struct GNUNET_MessageHeader)}, |
525 | sizeof (struct UnindexMessage) }, | 510 | {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX, |
526 | {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, | 511 | sizeof (struct UnindexMessage)}, |
527 | 0 }, | 512 | {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, |
513 | 0}, | ||
528 | {NULL, NULL, 0, 0} | 514 | {NULL, NULL, 0, 0} |
529 | }; | 515 | }; |
530 | 516 | ||
531 | GSF_core = GNUNET_CORE_connect (GSF_cfg, | 517 | GSF_core = GNUNET_CORE_connect (GSF_cfg, 2, /* larger? */ |
532 | 2, /* larger? */ | 518 | NULL, |
533 | NULL, | 519 | &peer_init_handler, |
534 | &peer_init_handler, | 520 | &peer_connect_handler, |
535 | &peer_connect_handler, | 521 | &GSF_peer_disconnect_handler_, |
536 | &GSF_peer_disconnect_handler_, | 522 | &GSF_peer_status_handler_, |
537 | &GSF_peer_status_handler_, | 523 | NULL, GNUNET_NO, |
538 | NULL, GNUNET_NO, | 524 | NULL, GNUNET_NO, p2p_handlers); |
539 | NULL, GNUNET_NO, | ||
540 | p2p_handlers); | ||
541 | if (NULL == GSF_core) | 525 | if (NULL == GSF_core) |
542 | { | 526 | { |
543 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 527 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
544 | _("Failed to connect to `%s' service.\n"), | 528 | _("Failed to connect to `%s' service.\n"), "core"); |
545 | "core"); | 529 | return GNUNET_SYSERR; |
546 | return GNUNET_SYSERR; | 530 | } |
547 | } | 531 | GNUNET_SERVER_disconnect_notify (server, |
548 | GNUNET_SERVER_disconnect_notify (server, | 532 | &GSF_client_disconnect_handler_, NULL); |
549 | &GSF_client_disconnect_handler_, | ||
550 | NULL); | ||
551 | GNUNET_SERVER_add_handlers (server, handlers); | 533 | GNUNET_SERVER_add_handlers (server, handlers); |
552 | cover_age_task = GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, | 534 | cover_age_task = GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, |
553 | &age_cover_counters, | 535 | &age_cover_counters, NULL); |
554 | NULL); | ||
555 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); | 536 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); |
556 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 537 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
557 | &shutdown_task, | 538 | &shutdown_task, NULL); |
558 | NULL); | ||
559 | return GNUNET_OK; | 539 | return GNUNET_OK; |
560 | } | 540 | } |
561 | 541 | ||
@@ -573,37 +553,33 @@ run (void *cls, | |||
573 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 553 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
574 | { | 554 | { |
575 | GSF_cfg = cfg; | 555 | GSF_cfg = cfg; |
576 | GSF_enable_randomized_delays = GNUNET_CONFIGURATION_get_value_yesno (cfg, "fs", "DELAY"); | 556 | GSF_enable_randomized_delays = |
557 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "fs", "DELAY"); | ||
577 | GSF_dsh = GNUNET_DATASTORE_connect (cfg); | 558 | GSF_dsh = GNUNET_DATASTORE_connect (cfg); |
578 | if (NULL == GSF_dsh) | 559 | if (NULL == GSF_dsh) |
579 | { | 560 | { |
580 | GNUNET_SCHEDULER_shutdown (); | 561 | GNUNET_SCHEDULER_shutdown (); |
581 | return; | 562 | return; |
582 | } | 563 | } |
583 | GSF_rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL); | 564 | GSF_rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL); |
584 | GSF_stats = GNUNET_STATISTICS_create ("fs", cfg); | 565 | GSF_stats = GNUNET_STATISTICS_create ("fs", cfg); |
585 | block_cfg = GNUNET_CONFIGURATION_create (); | 566 | block_cfg = GNUNET_CONFIGURATION_create (); |
586 | GNUNET_CONFIGURATION_set_value_string (block_cfg, | 567 | GNUNET_CONFIGURATION_set_value_string (block_cfg, "block", "PLUGINS", "fs"); |
587 | "block", | ||
588 | "PLUGINS", | ||
589 | "fs"); | ||
590 | GSF_block_ctx = GNUNET_BLOCK_context_create (block_cfg); | 568 | GSF_block_ctx = GNUNET_BLOCK_context_create (block_cfg); |
591 | GNUNET_assert (NULL != GSF_block_ctx); | 569 | GNUNET_assert (NULL != GSF_block_ctx); |
592 | GSF_dht = GNUNET_DHT_connect (cfg, | 570 | GSF_dht = GNUNET_DHT_connect (cfg, FS_DHT_HT_SIZE); |
593 | FS_DHT_HT_SIZE); | ||
594 | GSF_plan_init (); | 571 | GSF_plan_init (); |
595 | GSF_pending_request_init_ (); | 572 | GSF_pending_request_init_ (); |
596 | GSF_connected_peer_init_ (); | 573 | GSF_connected_peer_init_ (); |
597 | GSF_push_init_ (); | 574 | GSF_push_init_ (); |
598 | GSF_put_init_ (); | 575 | GSF_put_init_ (); |
599 | if ( (GNUNET_OK != GNUNET_FS_indexing_init (cfg, GSF_dsh)) || | 576 | if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg, GSF_dsh)) || |
600 | 577 | (GNUNET_OK != main_init (server, cfg))) | |
601 | (GNUNET_OK != main_init (server, cfg)) ) | 578 | { |
602 | { | 579 | GNUNET_SCHEDULER_shutdown (); |
603 | GNUNET_SCHEDULER_shutdown (); | 580 | shutdown_task (NULL, NULL); |
604 | shutdown_task (NULL, NULL); | 581 | return; |
605 | return; | 582 | } |
606 | } | ||
607 | } | 583 | } |
608 | 584 | ||
609 | 585 | ||
@@ -621,8 +597,7 @@ main (int argc, char *const *argv) | |||
621 | GNUNET_SERVICE_run (argc, | 597 | GNUNET_SERVICE_run (argc, |
622 | argv, | 598 | argv, |
623 | "fs", | 599 | "fs", |
624 | GNUNET_SERVICE_OPTION_NONE, | 600 | GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1; |
625 | &run, NULL)) ? 0 : 1; | ||
626 | } | 601 | } |
627 | 602 | ||
628 | /* end of gnunet-service-fs.c */ | 603 | /* end of gnunet-service-fs.c */ |