diff options
author | ng0 <ng0@n0.is> | 2019-09-06 23:01:06 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-06 23:01:06 +0000 |
commit | d0051cb6683c712cce3473d6b667208e4f61b75a (patch) | |
tree | 99f642c0e8f8c888a2bb3daa5280325dd8707d6d /src/hostlist | |
parent | 6e599264ad13e8fc105493d74d7c11d46f8739ed (diff) | |
download | gnunet-d0051cb6683c712cce3473d6b667208e4f61b75a.tar.gz gnunet-d0051cb6683c712cce3473d6b667208e4f61b75a.zip |
plibc, commit 2
Diffstat (limited to 'src/hostlist')
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist_client.c | 530 |
1 files changed, 289 insertions, 241 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index 539760966..0428e64b8 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include "gnunet_curl_lib.h" | 34 | #include "gnunet_curl_lib.h" |
35 | 35 | ||
36 | 36 | ||
37 | |||
38 | /** | 37 | /** |
39 | * Number of connections that we must have to NOT download | 38 | * Number of connections that we must have to NOT download |
40 | * hostlists anymore. | 39 | * hostlists anymore. |
@@ -49,17 +48,20 @@ | |||
49 | /** | 48 | /** |
50 | * Time interval hostlists are saved to disk | 49 | * Time interval hostlists are saved to disk |
51 | */ | 50 | */ |
52 | #define SAVING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) | 51 | #define SAVING_INTERVAL \ |
52 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) | ||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Time interval between two hostlist tests | 55 | * Time interval between two hostlist tests |
56 | */ | 56 | */ |
57 | #define TESTING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) | 57 | #define TESTING_INTERVAL \ |
58 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) | ||
58 | 59 | ||
59 | /** | 60 | /** |
60 | * Time interval for download dispatcher before a download is re-scheduled | 61 | * Time interval for download dispatcher before a download is re-scheduled |
61 | */ | 62 | */ |
62 | #define WAITING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 63 | #define WAITING_INTERVAL \ |
64 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
63 | 65 | ||
64 | /** | 66 | /** |
65 | * Defines concerning the hostlist quality metric | 67 | * Defines concerning the hostlist quality metric |
@@ -86,7 +88,6 @@ | |||
86 | #define HOSTLIST_SUCCESSFUL_HELLO 1 | 88 | #define HOSTLIST_SUCCESSFUL_HELLO 1 |
87 | 89 | ||
88 | 90 | ||
89 | |||
90 | /** | 91 | /** |
91 | * A single hostlist obtained by hostlist advertisements | 92 | * A single hostlist obtained by hostlist advertisements |
92 | */ | 93 | */ |
@@ -136,7 +137,6 @@ struct Hostlist | |||
136 | * Number of times the hostlist was successfully obtained | 137 | * Number of times the hostlist was successfully obtained |
137 | */ | 138 | */ |
138 | uint32_t times_used; | 139 | uint32_t times_used; |
139 | |||
140 | }; | 140 | }; |
141 | 141 | ||
142 | 142 | ||
@@ -321,10 +321,7 @@ static struct GNUNET_PEERINFO_Handle *pi; | |||
321 | * @return number of bytes that were processed (always size*nmemb) | 321 | * @return number of bytes that were processed (always size*nmemb) |
322 | */ | 322 | */ |
323 | static size_t | 323 | static size_t |
324 | callback_download (void *ptr, | 324 | callback_download (void *ptr, size_t size, size_t nmemb, void *ctx) |
325 | size_t size, | ||
326 | size_t nmemb, | ||
327 | void *ctx) | ||
328 | { | 325 | { |
329 | static char download_buffer[GNUNET_MAX_MESSAGE_SIZE - 1]; | 326 | static char download_buffer[GNUNET_MAX_MESSAGE_SIZE - 1]; |
330 | const char *cbuf = ptr; | 327 | const char *cbuf = ptr; |
@@ -338,13 +335,14 @@ callback_download (void *ptr, | |||
338 | stat_bytes_downloaded += total; | 335 | stat_bytes_downloaded += total; |
339 | if ((total == 0) || (stat_bogus_url)) | 336 | if ((total == 0) || (stat_bogus_url)) |
340 | { | 337 | { |
341 | return total; /* ok, no data or bogus data */ | 338 | return total; /* ok, no data or bogus data */ |
342 | } | 339 | } |
343 | 340 | ||
344 | GNUNET_STATISTICS_update (stats, | 341 | GNUNET_STATISTICS_update (stats, |
345 | gettext_noop | 342 | gettext_noop ( |
346 | ("# bytes downloaded from hostlist servers"), | 343 | "# bytes downloaded from hostlist servers"), |
347 | (int64_t) total, GNUNET_NO); | 344 | (int64_t) total, |
345 | GNUNET_NO); | ||
348 | left = total; | 346 | left = total; |
349 | while ((left > 0) || (download_pos > 0)) | 347 | while ((left > 0) || (download_pos > 0)) |
350 | { | 348 | { |
@@ -362,13 +360,15 @@ callback_download (void *ptr, | |||
362 | msize = ntohs (msg->size); | 360 | msize = ntohs (msg->size); |
363 | if (msize < sizeof (struct GNUNET_MessageHeader)) | 361 | if (msize < sizeof (struct GNUNET_MessageHeader)) |
364 | { | 362 | { |
365 | GNUNET_STATISTICS_update (stats, | 363 | GNUNET_STATISTICS_update ( |
366 | gettext_noop | 364 | stats, |
367 | ("# invalid HELLOs downloaded from hostlist servers"), | 365 | gettext_noop ("# invalid HELLOs downloaded from hostlist servers"), |
368 | 1, GNUNET_NO); | 366 | 1, |
367 | GNUNET_NO); | ||
369 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 368 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
370 | _("Invalid `%s' message received from hostlist at `%s'\n"), | 369 | _ ("Invalid `%s' message received from hostlist at `%s'\n"), |
371 | "HELLO", current_url); | 370 | "HELLO", |
371 | current_url); | ||
372 | stat_hellos_obtained++; | 372 | stat_hellos_obtained++; |
373 | stat_bogus_url = 1; | 373 | stat_bogus_url = 1; |
374 | return total; | 374 | return total; |
@@ -383,32 +383,34 @@ callback_download (void *ptr, | |||
383 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 383 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
384 | "Received valid `%s' message from hostlist server.\n", | 384 | "Received valid `%s' message from hostlist server.\n", |
385 | "HELLO"); | 385 | "HELLO"); |
386 | GNUNET_STATISTICS_update (stats, | 386 | GNUNET_STATISTICS_update ( |
387 | gettext_noop | 387 | stats, |
388 | ("# valid HELLOs downloaded from hostlist servers"), | 388 | gettext_noop ("# valid HELLOs downloaded from hostlist servers"), |
389 | 1, GNUNET_NO); | 389 | 1, |
390 | GNUNET_NO); | ||
390 | stat_hellos_obtained++; | 391 | stat_hellos_obtained++; |
391 | (void) GNUNET_PEERINFO_add_peer (pi, | 392 | (void) |
392 | (const struct GNUNET_HELLO_Message *) msg, | 393 | GNUNET_PEERINFO_add_peer (pi, |
393 | NULL, | 394 | (const struct GNUNET_HELLO_Message *) msg, |
394 | NULL); | 395 | NULL, |
396 | NULL); | ||
395 | } | 397 | } |
396 | else | 398 | else |
397 | { | 399 | { |
398 | GNUNET_STATISTICS_update (stats, | 400 | GNUNET_STATISTICS_update ( |
399 | gettext_noop | 401 | stats, |
400 | ("# invalid HELLOs downloaded from hostlist servers"), | 402 | gettext_noop ("# invalid HELLOs downloaded from hostlist servers"), |
401 | 1, GNUNET_NO); | 403 | 1, |
404 | GNUNET_NO); | ||
402 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 405 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
403 | _("Invalid `%s' message received from hostlist at `%s'\n"), | 406 | _ ("Invalid `%s' message received from hostlist at `%s'\n"), |
404 | "HELLO", current_url); | 407 | "HELLO", |
408 | current_url); | ||
405 | stat_bogus_url = GNUNET_YES; | 409 | stat_bogus_url = GNUNET_YES; |
406 | stat_hellos_obtained++; | 410 | stat_hellos_obtained++; |
407 | return total; | 411 | return total; |
408 | } | 412 | } |
409 | memmove (download_buffer, | 413 | memmove (download_buffer, &download_buffer[msize], download_pos - msize); |
410 | &download_buffer[msize], | ||
411 | download_pos - msize); | ||
412 | download_pos -= msize; | 414 | download_pos -= msize; |
413 | } | 415 | } |
414 | return total; | 416 | return total; |
@@ -428,12 +430,14 @@ get_bootstrap_server () | |||
428 | size_t urls; | 430 | size_t urls; |
429 | size_t pos; | 431 | size_t pos; |
430 | 432 | ||
431 | if (GNUNET_OK != | 433 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, |
432 | GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", "SERVERS", | 434 | "HOSTLIST", |
433 | &servers)) | 435 | "SERVERS", |
436 | &servers)) | ||
434 | { | 437 | { |
435 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, | 438 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, |
436 | "hostlist", "SERVERS"); | 439 | "hostlist", |
440 | "SERVERS"); | ||
437 | return NULL; | 441 | return NULL; |
438 | } | 442 | } |
439 | 443 | ||
@@ -452,7 +456,8 @@ get_bootstrap_server () | |||
452 | if (urls == 0) | 456 | if (urls == 0) |
453 | { | 457 | { |
454 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, | 458 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, |
455 | "hostlist", "SERVERS"); | 459 | "hostlist", |
460 | "SERVERS"); | ||
456 | GNUNET_free (servers); | 461 | GNUNET_free (servers); |
457 | return NULL; | 462 | return NULL; |
458 | } | 463 | } |
@@ -514,7 +519,7 @@ download_get_url () | |||
514 | return get_bootstrap_server (); | 519 | return get_bootstrap_server (); |
515 | } | 520 | } |
516 | index = | 521 | index = |
517 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, linked_list_size); | 522 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, linked_list_size); |
518 | counter = 0; | 523 | counter = 0; |
519 | pos = linked_list_head; | 524 | pos = linked_list_head; |
520 | while (counter < index) | 525 | while (counter < index) |
@@ -522,14 +527,26 @@ download_get_url () | |||
522 | pos = pos->next; | 527 | pos = pos->next; |
523 | counter++; | 528 | counter++; |
524 | } | 529 | } |
525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using learned hostlist `%s'\n", | 530 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
531 | "Using learned hostlist `%s'\n", | ||
526 | pos->hostlist_uri); | 532 | pos->hostlist_uri); |
527 | current_hostlist = pos; | 533 | current_hostlist = pos; |
528 | return GNUNET_strdup (pos->hostlist_uri); | 534 | return GNUNET_strdup (pos->hostlist_uri); |
529 | } | 535 | } |
530 | 536 | ||
531 | 537 | ||
532 | #define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt (c, a, b); if (CURLE_OK != ret) GNUNET_log(GNUNET_ERROR_TYPE_WARNING, _("%s failed at %s:%d: `%s'\n"), "curl_easy_setopt", __FILE__, __LINE__, curl_easy_strerror (ret)); } while (0) | 538 | #define CURL_EASY_SETOPT(c, a, b) \ |
539 | do \ | ||
540 | { \ | ||
541 | ret = curl_easy_setopt (c, a, b); \ | ||
542 | if (CURLE_OK != ret) \ | ||
543 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ | ||
544 | _ ("%s failed at %s:%d: `%s'\n"), \ | ||
545 | "curl_easy_setopt", \ | ||
546 | __FILE__, \ | ||
547 | __LINE__, \ | ||
548 | curl_easy_strerror (ret)); \ | ||
549 | } while (0) | ||
533 | 550 | ||
534 | 551 | ||
535 | /** | 552 | /** |
@@ -549,8 +566,7 @@ save_hostlist_file (int shutdown); | |||
549 | * @return result | 566 | * @return result |
550 | */ | 567 | */ |
551 | static uint64_t | 568 | static uint64_t |
552 | checked_add (uint64_t val1, | 569 | checked_add (uint64_t val1, uint64_t val2) |
553 | uint64_t val2) | ||
554 | { | 570 | { |
555 | static uint64_t temp; | 571 | static uint64_t temp; |
556 | static uint64_t maxv; | 572 | static uint64_t maxv; |
@@ -573,8 +589,7 @@ checked_add (uint64_t val1, | |||
573 | * @return result | 589 | * @return result |
574 | */ | 590 | */ |
575 | static uint64_t | 591 | static uint64_t |
576 | checked_sub (uint64_t val1, | 592 | checked_sub (uint64_t val1, uint64_t val2) |
577 | uint64_t val2) | ||
578 | { | 593 | { |
579 | if (val1 <= val2) | 594 | if (val1 <= val2) |
580 | return 0; | 595 | return 0; |
@@ -643,20 +658,25 @@ insert_hostlist () | |||
643 | /* No free entries available, replace existing entry */ | 658 | /* No free entries available, replace existing entry */ |
644 | lowest_quality = linked_list_get_lowest_quality (); | 659 | lowest_quality = linked_list_get_lowest_quality (); |
645 | GNUNET_assert (lowest_quality != NULL); | 660 | GNUNET_assert (lowest_quality != NULL); |
646 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 661 | GNUNET_log ( |
647 | "Removing hostlist with URI `%s' which has the worst quality of all (%llu)\n", | 662 | GNUNET_ERROR_TYPE_DEBUG, |
648 | lowest_quality->hostlist_uri, | 663 | "Removing hostlist with URI `%s' which has the worst quality of all (%llu)\n", |
649 | (unsigned long long) lowest_quality->quality); | 664 | lowest_quality->hostlist_uri, |
650 | GNUNET_CONTAINER_DLL_remove (linked_list_head, linked_list_tail, | 665 | (unsigned long long) lowest_quality->quality); |
666 | GNUNET_CONTAINER_DLL_remove (linked_list_head, | ||
667 | linked_list_tail, | ||
651 | lowest_quality); | 668 | lowest_quality); |
652 | linked_list_size--; | 669 | linked_list_size--; |
653 | GNUNET_free (lowest_quality); | 670 | GNUNET_free (lowest_quality); |
654 | } | 671 | } |
655 | GNUNET_CONTAINER_DLL_insert (linked_list_head, linked_list_tail, | 672 | GNUNET_CONTAINER_DLL_insert (linked_list_head, |
673 | linked_list_tail, | ||
656 | hostlist_to_test); | 674 | hostlist_to_test); |
657 | linked_list_size++; | 675 | linked_list_size++; |
658 | GNUNET_STATISTICS_set (stats, gettext_noop ("# advertised hostlist URIs"), | 676 | GNUNET_STATISTICS_set (stats, |
659 | linked_list_size, GNUNET_NO); | 677 | gettext_noop ("# advertised hostlist URIs"), |
678 | linked_list_size, | ||
679 | GNUNET_NO); | ||
660 | stat_testing_hostlist = GNUNET_NO; | 680 | stat_testing_hostlist = GNUNET_NO; |
661 | } | 681 | } |
662 | 682 | ||
@@ -678,14 +698,15 @@ update_hostlist () | |||
678 | current_hostlist->hello_count = stat_hellos_obtained; | 698 | current_hostlist->hello_count = stat_hellos_obtained; |
679 | current_hostlist->time_last_usage = GNUNET_TIME_absolute_get (); | 699 | current_hostlist->time_last_usage = GNUNET_TIME_absolute_get (); |
680 | current_hostlist->quality = | 700 | current_hostlist->quality = |
681 | checked_add (current_hostlist->quality, | 701 | checked_add (current_hostlist->quality, |
682 | (stat_hellos_obtained * HOSTLIST_SUCCESSFUL_HELLO)); | 702 | (stat_hellos_obtained * HOSTLIST_SUCCESSFUL_HELLO)); |
683 | if (GNUNET_YES == stat_download_successful) | 703 | if (GNUNET_YES == stat_download_successful) |
684 | { | 704 | { |
685 | current_hostlist->times_used++; | 705 | current_hostlist->times_used++; |
686 | current_hostlist->quality = | 706 | current_hostlist->quality = |
687 | checked_add (current_hostlist->quality, HOSTLIST_SUCCESSFUL_DOWNLOAD); | 707 | checked_add (current_hostlist->quality, HOSTLIST_SUCCESSFUL_DOWNLOAD); |
688 | GNUNET_asprintf (&stat, gettext_noop ("# advertised URI `%s' downloaded"), | 708 | GNUNET_asprintf (&stat, |
709 | gettext_noop ("# advertised URI `%s' downloaded"), | ||
689 | current_hostlist->hostlist_uri); | 710 | current_hostlist->hostlist_uri); |
690 | 711 | ||
691 | GNUNET_STATISTICS_update (stats, stat, 1, GNUNET_YES); | 712 | GNUNET_STATISTICS_update (stats, stat, 1, GNUNET_YES); |
@@ -693,7 +714,7 @@ update_hostlist () | |||
693 | } | 714 | } |
694 | else | 715 | else |
695 | current_hostlist->quality = | 716 | current_hostlist->quality = |
696 | checked_sub (current_hostlist->quality, HOSTLIST_FAILED_DOWNLOAD); | 717 | checked_sub (current_hostlist->quality, HOSTLIST_FAILED_DOWNLOAD); |
697 | } | 718 | } |
698 | current_hostlist = NULL; | 719 | current_hostlist = NULL; |
699 | /* Alternating the usage of preconfigured and learned hostlists */ | 720 | /* Alternating the usage of preconfigured and learned hostlists */ |
@@ -722,14 +743,14 @@ clean_up () | |||
722 | { | 743 | { |
723 | CURLMcode mret; | 744 | CURLMcode mret; |
724 | 745 | ||
725 | if ( (stat_testing_hostlist == GNUNET_YES) && | 746 | if ((stat_testing_hostlist == GNUNET_YES) && |
726 | (GNUNET_NO == stat_download_successful) && | 747 | (GNUNET_NO == stat_download_successful) && (NULL != hostlist_to_test)) |
727 | (NULL != hostlist_to_test) ) | ||
728 | { | 748 | { |
729 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 749 | GNUNET_log ( |
730 | _ | 750 | GNUNET_ERROR_TYPE_INFO, |
731 | ("Advertised hostlist with URI `%s' could not be downloaded. Advertised URI gets dismissed.\n"), | 751 | _ ( |
732 | hostlist_to_test->hostlist_uri); | 752 | "Advertised hostlist with URI `%s' could not be downloaded. Advertised URI gets dismissed.\n"), |
753 | hostlist_to_test->hostlist_uri); | ||
733 | } | 754 | } |
734 | 755 | ||
735 | if (stat_testing_hostlist == GNUNET_YES) | 756 | if (stat_testing_hostlist == GNUNET_YES) |
@@ -747,14 +768,20 @@ clean_up () | |||
747 | mret = curl_multi_remove_handle (multi, curl); | 768 | mret = curl_multi_remove_handle (multi, curl); |
748 | if (mret != CURLM_OK) | 769 | if (mret != CURLM_OK) |
749 | { | 770 | { |
750 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%s failed at %s:%d: `%s'\n"), | 771 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
751 | "curl_multi_remove_handle", __FILE__, __LINE__, | 772 | _ ("%s failed at %s:%d: `%s'\n"), |
773 | "curl_multi_remove_handle", | ||
774 | __FILE__, | ||
775 | __LINE__, | ||
752 | curl_multi_strerror (mret)); | 776 | curl_multi_strerror (mret)); |
753 | } | 777 | } |
754 | mret = curl_multi_cleanup (multi); | 778 | mret = curl_multi_cleanup (multi); |
755 | if (mret != CURLM_OK) | 779 | if (mret != CURLM_OK) |
756 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%s failed at %s:%d: `%s'\n"), | 780 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
757 | "curl_multi_cleanup", __FILE__, __LINE__, | 781 | _ ("%s failed at %s:%d: `%s'\n"), |
782 | "curl_multi_cleanup", | ||
783 | __FILE__, | ||
784 | __LINE__, | ||
758 | curl_multi_strerror (mret)); | 785 | curl_multi_strerror (mret)); |
759 | multi = NULL; | 786 | multi = NULL; |
760 | } | 787 | } |
@@ -805,8 +832,11 @@ download_prepare () | |||
805 | mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); | 832 | mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); |
806 | if (mret != CURLM_OK) | 833 | if (mret != CURLM_OK) |
807 | { | 834 | { |
808 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%s failed at %s:%d: `%s'\n"), | 835 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
809 | "curl_multi_fdset", __FILE__, __LINE__, | 836 | _ ("%s failed at %s:%d: `%s'\n"), |
837 | "curl_multi_fdset", | ||
838 | __FILE__, | ||
839 | __LINE__, | ||
810 | curl_multi_strerror (mret)); | 840 | curl_multi_strerror (mret)); |
811 | clean_up (); | 841 | clean_up (); |
812 | return; | 842 | return; |
@@ -814,26 +844,30 @@ download_prepare () | |||
814 | mret = curl_multi_timeout (multi, &timeout); | 844 | mret = curl_multi_timeout (multi, &timeout); |
815 | if (mret != CURLM_OK) | 845 | if (mret != CURLM_OK) |
816 | { | 846 | { |
817 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%s failed at %s:%d: `%s'\n"), | 847 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
818 | "curl_multi_timeout", __FILE__, __LINE__, | 848 | _ ("%s failed at %s:%d: `%s'\n"), |
849 | "curl_multi_timeout", | ||
850 | __FILE__, | ||
851 | __LINE__, | ||
819 | curl_multi_strerror (mret)); | 852 | curl_multi_strerror (mret)); |
820 | clean_up (); | 853 | clean_up (); |
821 | return; | 854 | return; |
822 | } | 855 | } |
823 | rtime = | 856 | rtime = GNUNET_TIME_relative_min ( |
824 | GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_remaining (end_time), | 857 | GNUNET_TIME_absolute_get_remaining (end_time), |
825 | GNUNET_TIME_relative_multiply | 858 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, timeout)); |
826 | (GNUNET_TIME_UNIT_MILLISECONDS, timeout)); | ||
827 | grs = GNUNET_NETWORK_fdset_create (); | 859 | grs = GNUNET_NETWORK_fdset_create (); |
828 | gws = GNUNET_NETWORK_fdset_create (); | 860 | gws = GNUNET_NETWORK_fdset_create (); |
829 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); | 861 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); |
830 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); | 862 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); |
831 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 863 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
832 | "Scheduling task for hostlist download using cURL\n"); | 864 | "Scheduling task for hostlist download using cURL\n"); |
833 | ti_download = | 865 | ti_download = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
834 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 866 | rtime, |
835 | rtime, grs, gws, | 867 | grs, |
836 | &task_download, multi); | 868 | gws, |
869 | &task_download, | ||
870 | multi); | ||
837 | GNUNET_NETWORK_fdset_destroy (gws); | 871 | GNUNET_NETWORK_fdset_destroy (gws); |
838 | GNUNET_NETWORK_fdset_destroy (grs); | 872 | GNUNET_NETWORK_fdset_destroy (grs); |
839 | } | 873 | } |
@@ -856,7 +890,7 @@ task_download (void *cls) | |||
856 | if (0 == GNUNET_TIME_absolute_get_remaining (end_time).rel_value_us) | 890 | if (0 == GNUNET_TIME_absolute_get_remaining (end_time).rel_value_us) |
857 | { | 891 | { |
858 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 892 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
859 | _("Timeout trying to download hostlist from `%s'\n"), | 893 | _ ("Timeout trying to download hostlist from `%s'\n"), |
860 | current_url); | 894 | current_url); |
861 | update_hostlist (); | 895 | update_hostlist (); |
862 | clean_up (); | 896 | clean_up (); |
@@ -870,7 +904,8 @@ task_download (void *cls) | |||
870 | if (stat_bytes_downloaded > MAX_BYTES_PER_HOSTLISTS) | 904 | if (stat_bytes_downloaded > MAX_BYTES_PER_HOSTLISTS) |
871 | { | 905 | { |
872 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 906 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
873 | _("Download limit of %u bytes exceeded, stopping download\n"), | 907 | _ ( |
908 | "Download limit of %u bytes exceeded, stopping download\n"), | ||
874 | MAX_BYTES_PER_HOSTLISTS); | 909 | MAX_BYTES_PER_HOSTLISTS); |
875 | clean_up (); | 910 | clean_up (); |
876 | return; | 911 | return; |
@@ -890,22 +925,22 @@ task_download (void *cls) | |||
890 | if ((msg->data.result != CURLE_OK) && | 925 | if ((msg->data.result != CURLE_OK) && |
891 | (msg->data.result != CURLE_GOT_NOTHING)) | 926 | (msg->data.result != CURLE_GOT_NOTHING)) |
892 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 927 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
893 | _("Download of hostlist from `%s' failed: `%s'\n"), | 928 | _ ("Download of hostlist from `%s' failed: `%s'\n"), |
894 | current_url, | 929 | current_url, |
895 | curl_easy_strerror (msg->data.result)); | 930 | curl_easy_strerror (msg->data.result)); |
896 | else | 931 | else |
897 | { | 932 | { |
898 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 933 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
899 | _("Download of hostlist `%s' completed.\n"), | 934 | _ ("Download of hostlist `%s' completed.\n"), |
900 | current_url); | 935 | current_url); |
901 | stat_download_successful = GNUNET_YES; | 936 | stat_download_successful = GNUNET_YES; |
902 | update_hostlist (); | 937 | update_hostlist (); |
903 | if (GNUNET_YES == stat_testing_hostlist) | 938 | if (GNUNET_YES == stat_testing_hostlist) |
904 | { | 939 | { |
905 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 940 | GNUNET_log ( |
906 | _ | 941 | GNUNET_ERROR_TYPE_INFO, |
907 | ("Adding successfully tested hostlist `%s' datastore.\n"), | 942 | _ ("Adding successfully tested hostlist `%s' datastore.\n"), |
908 | current_url); | 943 | current_url); |
909 | insert_hostlist (); | 944 | insert_hostlist (); |
910 | hostlist_to_test = NULL; | 945 | hostlist_to_test = NULL; |
911 | stat_testing_hostlist = GNUNET_NO; | 946 | stat_testing_hostlist = GNUNET_NO; |
@@ -917,16 +952,17 @@ task_download (void *cls) | |||
917 | break; | 952 | break; |
918 | } | 953 | } |
919 | 954 | ||
920 | } | 955 | } while ((running > 0)); |
921 | while ((running > 0)); | ||
922 | } | 956 | } |
923 | } | 957 | } while (mret == CURLM_CALL_MULTI_PERFORM); |
924 | while (mret == CURLM_CALL_MULTI_PERFORM); | ||
925 | 958 | ||
926 | if (mret != CURLM_OK) | 959 | if (mret != CURLM_OK) |
927 | { | 960 | { |
928 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("%s failed at %s:%d: `%s'\n"), | 961 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
929 | "curl_multi_perform", __FILE__, __LINE__, | 962 | _ ("%s failed at %s:%d: `%s'\n"), |
963 | "curl_multi_perform", | ||
964 | __FILE__, | ||
965 | __LINE__, | ||
930 | curl_multi_strerror (mret)); | 966 | curl_multi_strerror (mret)); |
931 | clean_up (); | 967 | clean_up (); |
932 | } | 968 | } |
@@ -957,7 +993,8 @@ download_hostlist () | |||
957 | return; | 993 | return; |
958 | } | 994 | } |
959 | GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, | 995 | GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, |
960 | _("Bootstrapping using hostlist at `%s'.\n"), current_url); | 996 | _ ("Bootstrapping using hostlist at `%s'.\n"), |
997 | current_url); | ||
961 | 998 | ||
962 | stat_download_in_progress = GNUNET_YES; | 999 | stat_download_in_progress = GNUNET_YES; |
963 | stat_download_successful = GNUNET_NO; | 1000 | stat_download_successful = GNUNET_NO; |
@@ -965,7 +1002,8 @@ download_hostlist () | |||
965 | stat_bytes_downloaded = 0; | 1002 | stat_bytes_downloaded = 0; |
966 | 1003 | ||
967 | GNUNET_STATISTICS_update (stats, | 1004 | GNUNET_STATISTICS_update (stats, |
968 | gettext_noop ("# hostlist downloads initiated"), 1, | 1005 | gettext_noop ("# hostlist downloads initiated"), |
1006 | 1, | ||
969 | GNUNET_NO); | 1007 | GNUNET_NO); |
970 | if (NULL != proxy) | 1008 | if (NULL != proxy) |
971 | { | 1009 | { |
@@ -991,7 +1029,9 @@ download_hostlist () | |||
991 | return; | 1029 | return; |
992 | } | 1030 | } |
993 | CURL_EASY_SETOPT (curl, CURLOPT_FOLLOWLOCATION, 1); | 1031 | CURL_EASY_SETOPT (curl, CURLOPT_FOLLOWLOCATION, 1); |
994 | CURL_EASY_SETOPT (curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); | 1032 | CURL_EASY_SETOPT (curl, |
1033 | CURLOPT_REDIR_PROTOCOLS, | ||
1034 | CURLPROTO_HTTP | CURLPROTO_HTTPS); | ||
995 | CURL_EASY_SETOPT (curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); | 1035 | CURL_EASY_SETOPT (curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); |
996 | CURL_EASY_SETOPT (curl, CURLOPT_MAXREDIRS, 4); | 1036 | CURL_EASY_SETOPT (curl, CURLOPT_MAXREDIRS, 4); |
997 | /* no need to abort if the above failed */ | 1037 | /* no need to abort if the above failed */ |
@@ -1020,13 +1060,19 @@ download_hostlist () | |||
1020 | mret = curl_multi_add_handle (multi, curl); | 1060 | mret = curl_multi_add_handle (multi, curl); |
1021 | if (mret != CURLM_OK) | 1061 | if (mret != CURLM_OK) |
1022 | { | 1062 | { |
1023 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%s failed at %s:%d: `%s'\n"), | 1063 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1024 | "curl_multi_add_handle", __FILE__, __LINE__, | 1064 | _ ("%s failed at %s:%d: `%s'\n"), |
1065 | "curl_multi_add_handle", | ||
1066 | __FILE__, | ||
1067 | __LINE__, | ||
1025 | curl_multi_strerror (mret)); | 1068 | curl_multi_strerror (mret)); |
1026 | mret = curl_multi_cleanup (multi); | 1069 | mret = curl_multi_cleanup (multi); |
1027 | if (mret != CURLM_OK) | 1070 | if (mret != CURLM_OK) |
1028 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%s failed at %s:%d: `%s'\n"), | 1071 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1029 | "curl_multi_cleanup", __FILE__, __LINE__, | 1072 | _ ("%s failed at %s:%d: `%s'\n"), |
1073 | "curl_multi_cleanup", | ||
1074 | __FILE__, | ||
1075 | __LINE__, | ||
1030 | curl_multi_strerror (mret)); | 1076 | curl_multi_strerror (mret)); |
1031 | multi = NULL; | 1077 | multi = NULL; |
1032 | clean_up (); | 1078 | clean_up (); |
@@ -1052,8 +1098,9 @@ task_download_dispatcher (void *cls) | |||
1052 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1098 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1053 | "Download in progess, have to wait...\n"); | 1099 | "Download in progess, have to wait...\n"); |
1054 | ti_download_dispatcher_task = | 1100 | ti_download_dispatcher_task = |
1055 | GNUNET_SCHEDULER_add_delayed (WAITING_INTERVAL, | 1101 | GNUNET_SCHEDULER_add_delayed (WAITING_INTERVAL, |
1056 | &task_download_dispatcher, NULL); | 1102 | &task_download_dispatcher, |
1103 | NULL); | ||
1057 | } | 1104 | } |
1058 | } | 1105 | } |
1059 | 1106 | ||
@@ -1073,12 +1120,12 @@ task_check (void *cls) | |||
1073 | if (stats == NULL) | 1120 | if (stats == NULL) |
1074 | { | 1121 | { |
1075 | curl_global_cleanup (); | 1122 | curl_global_cleanup (); |
1076 | return; /* in shutdown */ | 1123 | return; /* in shutdown */ |
1077 | } | 1124 | } |
1078 | if ( (stat_connection_count < MIN_CONNECTIONS) && | 1125 | if ((stat_connection_count < MIN_CONNECTIONS) && |
1079 | (NULL == ti_download_dispatcher_task) ) | 1126 | (NULL == ti_download_dispatcher_task)) |
1080 | ti_download_dispatcher_task = | 1127 | ti_download_dispatcher_task = |
1081 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); | 1128 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); |
1082 | 1129 | ||
1083 | delay = hostlist_delay; | 1130 | delay = hostlist_delay; |
1084 | if (0 == hostlist_delay.rel_value_us) | 1131 | if (0 == hostlist_delay.rel_value_us) |
@@ -1088,24 +1135,25 @@ task_check (void *cls) | |||
1088 | if (hostlist_delay.rel_value_us > | 1135 | if (hostlist_delay.rel_value_us > |
1089 | GNUNET_TIME_UNIT_HOURS.rel_value_us * (1 + stat_connection_count)) | 1136 | GNUNET_TIME_UNIT_HOURS.rel_value_us * (1 + stat_connection_count)) |
1090 | hostlist_delay = | 1137 | hostlist_delay = |
1091 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, | 1138 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, |
1092 | (1 + stat_connection_count)); | 1139 | (1 + stat_connection_count)); |
1093 | GNUNET_STATISTICS_set (stats, | 1140 | GNUNET_STATISTICS_set (stats, |
1094 | gettext_noop | 1141 | gettext_noop ( |
1095 | ("# milliseconds between hostlist downloads"), | 1142 | "# milliseconds between hostlist downloads"), |
1096 | hostlist_delay.rel_value_us / 1000LL, | 1143 | hostlist_delay.rel_value_us / 1000LL, |
1097 | GNUNET_YES); | 1144 | GNUNET_YES); |
1098 | if (0 == once) | 1145 | if (0 == once) |
1099 | { | 1146 | { |
1100 | delay = GNUNET_TIME_UNIT_ZERO; | 1147 | delay = GNUNET_TIME_UNIT_ZERO; |
1101 | once = 1; | 1148 | once = 1; |
1102 | } | 1149 | } |
1103 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1150 | GNUNET_log ( |
1104 | _("Have %u/%u connections. Will consider downloading hostlist in %s\n"), | 1151 | GNUNET_ERROR_TYPE_INFO, |
1105 | stat_connection_count, MIN_CONNECTIONS, | 1152 | _ ("Have %u/%u connections. Will consider downloading hostlist in %s\n"), |
1106 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); | 1153 | stat_connection_count, |
1107 | ti_check_download = GNUNET_SCHEDULER_add_delayed (delay, | 1154 | MIN_CONNECTIONS, |
1108 | &task_check, NULL); | 1155 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); |
1156 | ti_check_download = GNUNET_SCHEDULER_add_delayed (delay, &task_check, NULL); | ||
1109 | } | 1157 | } |
1110 | 1158 | ||
1111 | 1159 | ||
@@ -1137,11 +1185,10 @@ task_hostlist_saving (void *cls) | |||
1137 | 1185 | ||
1138 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1139 | "Hostlists will be saved to file again in %s\n", | 1187 | "Hostlists will be saved to file again in %s\n", |
1140 | GNUNET_STRINGS_relative_time_to_string(SAVING_INTERVAL, GNUNET_YES)); | 1188 | GNUNET_STRINGS_relative_time_to_string (SAVING_INTERVAL, |
1189 | GNUNET_YES)); | ||
1141 | ti_saving_task = | 1190 | ti_saving_task = |
1142 | GNUNET_SCHEDULER_add_delayed (SAVING_INTERVAL, | 1191 | GNUNET_SCHEDULER_add_delayed (SAVING_INTERVAL, &task_hostlist_saving, NULL); |
1143 | &task_hostlist_saving, | ||
1144 | NULL); | ||
1145 | } | 1192 | } |
1146 | 1193 | ||
1147 | 1194 | ||
@@ -1154,14 +1201,14 @@ task_hostlist_saving (void *cls) | |||
1154 | */ | 1201 | */ |
1155 | static void * | 1202 | static void * |
1156 | handler_connect (void *cls, | 1203 | handler_connect (void *cls, |
1157 | const struct GNUNET_PeerIdentity *peer, | 1204 | const struct GNUNET_PeerIdentity *peer, |
1158 | struct GNUNET_MQ_Handle *mq) | 1205 | struct GNUNET_MQ_Handle *mq) |
1159 | { | 1206 | { |
1160 | GNUNET_assert (stat_connection_count < UINT_MAX); | 1207 | GNUNET_assert (stat_connection_count < UINT_MAX); |
1161 | stat_connection_count++; | 1208 | stat_connection_count++; |
1162 | GNUNET_STATISTICS_update (stats, | 1209 | GNUNET_STATISTICS_update (stats, |
1163 | gettext_noop ("# active connections"), | 1210 | gettext_noop ("# active connections"), |
1164 | 1, | 1211 | 1, |
1165 | GNUNET_NO); | 1212 | GNUNET_NO); |
1166 | return NULL; | 1213 | return NULL; |
1167 | } | 1214 | } |
@@ -1175,14 +1222,14 @@ handler_connect (void *cls, | |||
1175 | */ | 1222 | */ |
1176 | static void | 1223 | static void |
1177 | handler_disconnect (void *cls, | 1224 | handler_disconnect (void *cls, |
1178 | const struct GNUNET_PeerIdentity *peer, | 1225 | const struct GNUNET_PeerIdentity *peer, |
1179 | void *internal_cls) | 1226 | void *internal_cls) |
1180 | { | 1227 | { |
1181 | GNUNET_assert (stat_connection_count > 0); | 1228 | GNUNET_assert (stat_connection_count > 0); |
1182 | stat_connection_count--; | 1229 | stat_connection_count--; |
1183 | GNUNET_STATISTICS_update (stats, | 1230 | GNUNET_STATISTICS_update (stats, |
1184 | gettext_noop ("# active connections"), | 1231 | gettext_noop ("# active connections"), |
1185 | -1, | 1232 | -1, |
1186 | GNUNET_NO); | 1233 | GNUNET_NO); |
1187 | } | 1234 | } |
1188 | 1235 | ||
@@ -1201,33 +1248,31 @@ handler_advertisement (const char *uri) | |||
1201 | uri_size = strlen (uri) + 1; | 1248 | uri_size = strlen (uri) + 1; |
1202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1249 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1203 | "Hostlist client recieved advertisement containing URI `%s'\n", | 1250 | "Hostlist client recieved advertisement containing URI `%s'\n", |
1204 | uri); | 1251 | uri); |
1205 | if (GNUNET_NO != linked_list_contains (uri)) | 1252 | if (GNUNET_NO != linked_list_contains (uri)) |
1206 | { | 1253 | { |
1207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1254 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "URI `%s' is already known\n", uri); |
1208 | "URI `%s' is already known\n", | ||
1209 | uri); | ||
1210 | return; | 1255 | return; |
1211 | } | 1256 | } |
1212 | 1257 | ||
1213 | if (GNUNET_NO == stat_testing_allowed) | 1258 | if (GNUNET_NO == stat_testing_allowed) |
1214 | { | 1259 | { |
1215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1260 | GNUNET_log ( |
1216 | "Currently not accepting new advertisements: interval between to advertisements is not reached\n"); | 1261 | GNUNET_ERROR_TYPE_DEBUG, |
1262 | "Currently not accepting new advertisements: interval between to advertisements is not reached\n"); | ||
1217 | return; | 1263 | return; |
1218 | } | 1264 | } |
1219 | if (GNUNET_YES == stat_testing_hostlist) | 1265 | if (GNUNET_YES == stat_testing_hostlist) |
1220 | { | 1266 | { |
1221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1267 | GNUNET_log ( |
1222 | "Currently not accepting new advertisements: we are already testing a hostlist\n"); | 1268 | GNUNET_ERROR_TYPE_DEBUG, |
1269 | "Currently not accepting new advertisements: we are already testing a hostlist\n"); | ||
1223 | return; | 1270 | return; |
1224 | } | 1271 | } |
1225 | 1272 | ||
1226 | hostlist = GNUNET_malloc (sizeof (struct Hostlist) + uri_size); | 1273 | hostlist = GNUNET_malloc (sizeof (struct Hostlist) + uri_size); |
1227 | hostlist->hostlist_uri = (const char *) &hostlist[1]; | 1274 | hostlist->hostlist_uri = (const char *) &hostlist[1]; |
1228 | GNUNET_memcpy (&hostlist[1], | 1275 | GNUNET_memcpy (&hostlist[1], uri, uri_size); |
1229 | uri, | ||
1230 | uri_size); | ||
1231 | hostlist->time_creation = GNUNET_TIME_absolute_get (); | 1276 | hostlist->time_creation = GNUNET_TIME_absolute_get (); |
1232 | hostlist->quality = HOSTLIST_INITIAL; | 1277 | hostlist->quality = HOSTLIST_INITIAL; |
1233 | hostlist_to_test = hostlist; | 1278 | hostlist_to_test = hostlist; |
@@ -1235,18 +1280,17 @@ handler_advertisement (const char *uri) | |||
1235 | stat_testing_hostlist = GNUNET_YES; | 1280 | stat_testing_hostlist = GNUNET_YES; |
1236 | stat_testing_allowed = GNUNET_NO; | 1281 | stat_testing_allowed = GNUNET_NO; |
1237 | ti_testing_intervall_task = | 1282 | ti_testing_intervall_task = |
1238 | GNUNET_SCHEDULER_add_delayed (TESTING_INTERVAL, | 1283 | GNUNET_SCHEDULER_add_delayed (TESTING_INTERVAL, |
1239 | &task_testing_intervall_reset, | 1284 | &task_testing_intervall_reset, |
1240 | NULL); | 1285 | NULL); |
1241 | 1286 | ||
1242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1287 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1243 | "Testing new hostlist advertisements is locked for the next %s\n", | 1288 | "Testing new hostlist advertisements is locked for the next %s\n", |
1244 | GNUNET_STRINGS_relative_time_to_string (TESTING_INTERVAL, | 1289 | GNUNET_STRINGS_relative_time_to_string (TESTING_INTERVAL, |
1245 | GNUNET_YES)); | 1290 | GNUNET_YES)); |
1246 | 1291 | ||
1247 | ti_download_dispatcher_task = | 1292 | ti_download_dispatcher_task = |
1248 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, | 1293 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); |
1249 | NULL); | ||
1250 | } | 1294 | } |
1251 | 1295 | ||
1252 | 1296 | ||
@@ -1259,8 +1303,7 @@ handler_advertisement (const char *uri) | |||
1259 | * successfully obtained, #GNUNET_SYSERR if not. | 1303 | * successfully obtained, #GNUNET_SYSERR if not. |
1260 | */ | 1304 | */ |
1261 | static void | 1305 | static void |
1262 | primary_task (void *cls, | 1306 | primary_task (void *cls, int success) |
1263 | int success) | ||
1264 | { | 1307 | { |
1265 | if (NULL != ti_check_download) | 1308 | if (NULL != ti_check_download) |
1266 | { | 1309 | { |
@@ -1288,8 +1331,7 @@ stat_timeout_task (void *cls) | |||
1288 | { | 1331 | { |
1289 | GNUNET_STATISTICS_get_cancel (sget); | 1332 | GNUNET_STATISTICS_get_cancel (sget); |
1290 | sget = NULL; | 1333 | sget = NULL; |
1291 | ti_check_download = GNUNET_SCHEDULER_add_now (&task_check, | 1334 | ti_check_download = GNUNET_SCHEDULER_add_now (&task_check, NULL); |
1292 | NULL); | ||
1293 | } | 1335 | } |
1294 | 1336 | ||
1295 | 1337 | ||
@@ -1337,22 +1379,25 @@ load_hostlist_file () | |||
1337 | struct GNUNET_BIO_ReadHandle *rh; | 1379 | struct GNUNET_BIO_ReadHandle *rh; |
1338 | 1380 | ||
1339 | uri = NULL; | 1381 | uri = NULL; |
1340 | if (GNUNET_OK != | 1382 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, |
1341 | GNUNET_CONFIGURATION_get_value_filename (cfg, "HOSTLIST", "HOSTLISTFILE", | 1383 | "HOSTLIST", |
1342 | &filename)) | 1384 | "HOSTLISTFILE", |
1385 | &filename)) | ||
1343 | { | 1386 | { |
1344 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, | 1387 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, |
1345 | "hostlist", "HOSTLISTFILE"); | 1388 | "hostlist", |
1389 | "HOSTLISTFILE"); | ||
1346 | return; | 1390 | return; |
1347 | } | 1391 | } |
1348 | 1392 | ||
1349 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1393 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1350 | _("Loading saved hostlist entries from file `%s' \n"), | 1394 | _ ("Loading saved hostlist entries from file `%s' \n"), |
1351 | filename); | 1395 | filename); |
1352 | if (GNUNET_NO == GNUNET_DISK_file_test (filename)) | 1396 | if (GNUNET_NO == GNUNET_DISK_file_test (filename)) |
1353 | { | 1397 | { |
1354 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1398 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1355 | _("Hostlist file `%s' does not exist\n"), filename); | 1399 | _ ("Hostlist file `%s' does not exist\n"), |
1400 | filename); | ||
1356 | GNUNET_free (filename); | 1401 | GNUNET_free (filename); |
1357 | return; | 1402 | return; |
1358 | } | 1403 | } |
@@ -1361,16 +1406,19 @@ load_hostlist_file () | |||
1361 | if (NULL == rh) | 1406 | if (NULL == rh) |
1362 | { | 1407 | { |
1363 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1408 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1364 | _("Could not open file `%s' for reading to load hostlists: %s\n"), | 1409 | _ ( |
1365 | filename, STRERROR (errno)); | 1410 | "Could not open file `%s' for reading to load hostlists: %s\n"), |
1411 | filename, | ||
1412 | strerror (errno)); | ||
1366 | GNUNET_free (filename); | 1413 | GNUNET_free (filename); |
1367 | return; | 1414 | return; |
1368 | } | 1415 | } |
1369 | 1416 | ||
1370 | counter = 0; | 1417 | counter = 0; |
1371 | while ((GNUNET_OK == GNUNET_BIO_read_string (rh, "url", &uri, MAX_URL_LEN)) && | 1418 | while ((GNUNET_OK == GNUNET_BIO_read_string (rh, "url", &uri, MAX_URL_LEN)) && |
1372 | (NULL != uri) && (GNUNET_OK == GNUNET_BIO_read_int32 (rh, ×_used)) | 1419 | (NULL != uri) && |
1373 | && (GNUNET_OK == GNUNET_BIO_read_int64 (rh, &quality)) && | 1420 | (GNUNET_OK == GNUNET_BIO_read_int32 (rh, ×_used)) && |
1421 | (GNUNET_OK == GNUNET_BIO_read_int64 (rh, &quality)) && | ||
1374 | (GNUNET_OK == GNUNET_BIO_read_int64 (rh, &last_used)) && | 1422 | (GNUNET_OK == GNUNET_BIO_read_int64 (rh, &last_used)) && |
1375 | (GNUNET_OK == GNUNET_BIO_read_int64 (rh, &created)) && | 1423 | (GNUNET_OK == GNUNET_BIO_read_int64 (rh, &created)) && |
1376 | (GNUNET_OK == GNUNET_BIO_read_int32 (rh, &hellos_returned))) | 1424 | (GNUNET_OK == GNUNET_BIO_read_int32 (rh, &hellos_returned))) |
@@ -1395,14 +1443,16 @@ load_hostlist_file () | |||
1395 | } | 1443 | } |
1396 | 1444 | ||
1397 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1445 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1398 | _("%u hostlist URIs loaded from file\n"), | 1446 | _ ("%u hostlist URIs loaded from file\n"), |
1399 | counter); | 1447 | counter); |
1400 | GNUNET_STATISTICS_set (stats, | 1448 | GNUNET_STATISTICS_set (stats, |
1401 | gettext_noop ("# hostlist URIs read from file"), | 1449 | gettext_noop ("# hostlist URIs read from file"), |
1402 | counter, GNUNET_YES); | 1450 | counter, |
1451 | GNUNET_YES); | ||
1403 | GNUNET_STATISTICS_set (stats, | 1452 | GNUNET_STATISTICS_set (stats, |
1404 | gettext_noop ("# advertised hostlist URIs"), | 1453 | gettext_noop ("# advertised hostlist URIs"), |
1405 | linked_list_size, GNUNET_NO); | 1454 | linked_list_size, |
1455 | GNUNET_NO); | ||
1406 | 1456 | ||
1407 | GNUNET_free_non_null (uri); | 1457 | GNUNET_free_non_null (uri); |
1408 | emsg = NULL; | 1458 | emsg = NULL; |
@@ -1427,12 +1477,14 @@ save_hostlist_file (int shutdown) | |||
1427 | int ok; | 1477 | int ok; |
1428 | uint32_t counter; | 1478 | uint32_t counter; |
1429 | 1479 | ||
1430 | if (GNUNET_OK != | 1480 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, |
1431 | GNUNET_CONFIGURATION_get_value_filename (cfg, "HOSTLIST", "HOSTLISTFILE", | 1481 | "HOSTLIST", |
1432 | &filename)) | 1482 | "HOSTLISTFILE", |
1483 | &filename)) | ||
1433 | { | 1484 | { |
1434 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, | 1485 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, |
1435 | "hostlist", "HOSTLISTFILE"); | 1486 | "hostlist", |
1487 | "HOSTLISTFILE"); | ||
1436 | return; | 1488 | return; |
1437 | } | 1489 | } |
1438 | if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename)) | 1490 | if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename)) |
@@ -1444,15 +1496,17 @@ save_hostlist_file (int shutdown) | |||
1444 | if (NULL == wh) | 1496 | if (NULL == wh) |
1445 | { | 1497 | { |
1446 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1498 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1447 | _("Could not open file `%s' for writing to save hostlists: %s\n"), | 1499 | _ ( |
1500 | "Could not open file `%s' for writing to save hostlists: %s\n"), | ||
1448 | filename, | 1501 | filename, |
1449 | STRERROR (errno)); | 1502 | strerror (errno)); |
1450 | GNUNET_free (filename); | 1503 | GNUNET_free (filename); |
1451 | return; | 1504 | return; |
1452 | } | 1505 | } |
1453 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1506 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1454 | _("Writing %u hostlist URIs to `%s'\n"), | 1507 | _ ("Writing %u hostlist URIs to `%s'\n"), |
1455 | linked_list_size, filename); | 1508 | linked_list_size, |
1509 | filename); | ||
1456 | /* add code to write hostlists to file using bio */ | 1510 | /* add code to write hostlists to file using bio */ |
1457 | ok = GNUNET_YES; | 1511 | ok = GNUNET_YES; |
1458 | counter = 0; | 1512 | counter = 0; |
@@ -1475,7 +1529,8 @@ save_hostlist_file (int shutdown) | |||
1475 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->hello_count))) | 1529 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->hello_count))) |
1476 | { | 1530 | { |
1477 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1531 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1478 | _("Error writing hostlist URIs to file `%s'\n"), filename); | 1532 | _ ("Error writing hostlist URIs to file `%s'\n"), |
1533 | filename); | ||
1479 | ok = GNUNET_NO; | 1534 | ok = GNUNET_NO; |
1480 | } | 1535 | } |
1481 | } | 1536 | } |
@@ -1488,11 +1543,13 @@ save_hostlist_file (int shutdown) | |||
1488 | } | 1543 | } |
1489 | GNUNET_STATISTICS_set (stats, | 1544 | GNUNET_STATISTICS_set (stats, |
1490 | gettext_noop ("# hostlist URIs written to file"), | 1545 | gettext_noop ("# hostlist URIs written to file"), |
1491 | counter, GNUNET_YES); | 1546 | counter, |
1547 | GNUNET_YES); | ||
1492 | 1548 | ||
1493 | if (GNUNET_OK != GNUNET_BIO_write_close (wh)) | 1549 | if (GNUNET_OK != GNUNET_BIO_write_close (wh)) |
1494 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1550 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1495 | _("Error writing hostlist URIs to file `%s'\n"), filename); | 1551 | _ ("Error writing hostlist URIs to file `%s'\n"), |
1552 | filename); | ||
1496 | GNUNET_free (filename); | 1553 | GNUNET_free (filename); |
1497 | } | 1554 | } |
1498 | 1555 | ||
@@ -1532,47 +1589,38 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1532 | /* Read proxy configuration */ | 1589 | /* Read proxy configuration */ |
1533 | pi = GNUNET_PEERINFO_connect (c); | 1590 | pi = GNUNET_PEERINFO_connect (c); |
1534 | if (GNUNET_OK == | 1591 | if (GNUNET_OK == |
1535 | GNUNET_CONFIGURATION_get_value_string (cfg, | 1592 | GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", "PROXY", &proxy)) |
1536 | "HOSTLIST", | ||
1537 | "PROXY", | ||
1538 | &proxy)) | ||
1539 | { | 1593 | { |
1540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found proxy host: `%s'\n", proxy); |
1541 | "Found proxy host: `%s'\n", | ||
1542 | proxy); | ||
1543 | /* proxy username */ | 1595 | /* proxy username */ |
1544 | if (GNUNET_OK == | 1596 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, |
1545 | GNUNET_CONFIGURATION_get_value_string (cfg, | 1597 | "HOSTLIST", |
1546 | "HOSTLIST", | 1598 | "PROXY_USERNAME", |
1547 | "PROXY_USERNAME", | 1599 | &proxy_username)) |
1548 | &proxy_username)) | ||
1549 | { | 1600 | { |
1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1601 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1551 | "Found proxy username name: `%s'\n", | 1602 | "Found proxy username name: `%s'\n", |
1552 | proxy_username); | 1603 | proxy_username); |
1553 | } | 1604 | } |
1554 | 1605 | ||
1555 | /* proxy password */ | 1606 | /* proxy password */ |
1556 | if (GNUNET_OK == | 1607 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, |
1557 | GNUNET_CONFIGURATION_get_value_string (cfg, | 1608 | "HOSTLIST", |
1558 | "HOSTLIST", | 1609 | "PROXY_PASSWORD", |
1559 | "PROXY_PASSWORD", | 1610 | &proxy_password)) |
1560 | &proxy_password)) | ||
1561 | { | 1611 | { |
1562 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1612 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1563 | "Found proxy password name: `%s'\n", | 1613 | "Found proxy password name: `%s'\n", |
1564 | proxy_password); | 1614 | proxy_password); |
1565 | } | 1615 | } |
1566 | 1616 | ||
1567 | /* proxy type */ | 1617 | /* proxy type */ |
1568 | if (GNUNET_OK == | 1618 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, |
1569 | GNUNET_CONFIGURATION_get_value_string (cfg, | 1619 | "HOSTLIST", |
1570 | "HOSTLIST", | 1620 | "PROXY_TYPE", |
1571 | "PROXY_TYPE", | 1621 | &proxytype_str)) |
1572 | &proxytype_str)) | ||
1573 | { | 1622 | { |
1574 | GNUNET_STRINGS_utf8_toupper (proxytype_str, | 1623 | GNUNET_STRINGS_utf8_toupper (proxytype_str, proxytype_str); |
1575 | proxytype_str); | ||
1576 | proxy_type = CURLPROXY_HTTP; | 1624 | proxy_type = CURLPROXY_HTTP; |
1577 | if (0 == strcmp (proxytype_str, "HTTP")) | 1625 | if (0 == strcmp (proxytype_str, "HTTP")) |
1578 | proxy_type = CURLPROXY_HTTP; | 1626 | proxy_type = CURLPROXY_HTTP; |
@@ -1588,9 +1636,11 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1588 | proxy_type = CURLPROXY_SOCKS5_HOSTNAME; | 1636 | proxy_type = CURLPROXY_SOCKS5_HOSTNAME; |
1589 | else | 1637 | else |
1590 | { | 1638 | { |
1591 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1639 | GNUNET_log ( |
1592 | _("Invalid proxy type: `%s', disabling proxy! Check configuration!\n"), | 1640 | GNUNET_ERROR_TYPE_ERROR, |
1593 | proxytype_str); | 1641 | _ ( |
1642 | "Invalid proxy type: `%s', disabling proxy! Check configuration!\n"), | ||
1643 | proxytype_str); | ||
1594 | GNUNET_free (proxytype_str); | 1644 | GNUNET_free (proxytype_str); |
1595 | GNUNET_free (proxy); | 1645 | GNUNET_free (proxy); |
1596 | proxy = NULL; | 1646 | proxy = NULL; |
@@ -1618,35 +1668,35 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1618 | { | 1668 | { |
1619 | *msgh = &handler_advertisement; | 1669 | *msgh = &handler_advertisement; |
1620 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1670 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1621 | _("Learning is enabled on this peer\n")); | 1671 | _ ("Learning is enabled on this peer\n")); |
1622 | load_hostlist_file (); | 1672 | load_hostlist_file (); |
1623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1673 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1624 | "Hostlists will be saved to file again in %s\n", | 1674 | "Hostlists will be saved to file again in %s\n", |
1625 | GNUNET_STRINGS_relative_time_to_string (SAVING_INTERVAL, | 1675 | GNUNET_STRINGS_relative_time_to_string (SAVING_INTERVAL, |
1626 | GNUNET_YES)); | 1676 | GNUNET_YES)); |
1627 | ti_saving_task = | 1677 | ti_saving_task = GNUNET_SCHEDULER_add_delayed (SAVING_INTERVAL, |
1628 | GNUNET_SCHEDULER_add_delayed (SAVING_INTERVAL, | 1678 | &task_hostlist_saving, |
1629 | &task_hostlist_saving, | 1679 | NULL); |
1630 | NULL); | ||
1631 | } | 1680 | } |
1632 | else | 1681 | else |
1633 | { | 1682 | { |
1634 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1683 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1635 | _("Learning is not enabled on this peer\n")); | 1684 | _ ("Learning is not enabled on this peer\n")); |
1636 | *msgh = NULL; | 1685 | *msgh = NULL; |
1637 | if (GNUNET_OK == | 1686 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg, |
1638 | GNUNET_CONFIGURATION_get_value_filename (cfg, | 1687 | "HOSTLIST", |
1639 | "HOSTLIST", | 1688 | "HOSTLISTFILE", |
1640 | "HOSTLISTFILE", | 1689 | &filename)) |
1641 | &filename)) | ||
1642 | { | 1690 | { |
1643 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | 1691 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) |
1644 | { | 1692 | { |
1645 | result = remove (filename); | 1693 | result = remove (filename); |
1646 | if (0 == result) | 1694 | if (0 == result) |
1647 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1695 | GNUNET_log ( |
1648 | _("Since learning is not enabled on this peer, hostlist file `%s' was removed\n"), | 1696 | GNUNET_ERROR_TYPE_INFO, |
1649 | filename); | 1697 | _ ( |
1698 | "Since learning is not enabled on this peer, hostlist file `%s' was removed\n"), | ||
1699 | filename); | ||
1650 | else | 1700 | else |
1651 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | 1701 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
1652 | "remove", | 1702 | "remove", |
@@ -1657,25 +1707,24 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1657 | } | 1707 | } |
1658 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1708 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1659 | "Loading stats value on hostlist download frequency\n"); | 1709 | "Loading stats value on hostlist download frequency\n"); |
1660 | sget = GNUNET_STATISTICS_get (stats, "hostlist", | 1710 | sget = GNUNET_STATISTICS_get (stats, |
1661 | gettext_noop | 1711 | "hostlist", |
1662 | ("# milliseconds between hostlist downloads"), | 1712 | gettext_noop ( |
1713 | "# milliseconds between hostlist downloads"), | ||
1663 | &primary_task, | 1714 | &primary_task, |
1664 | &process_stat, | 1715 | &process_stat, |
1665 | NULL); | 1716 | NULL); |
1666 | if (NULL == sget) | 1717 | if (NULL == sget) |
1667 | { | 1718 | { |
1668 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1719 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1669 | "Statistics request failed, scheduling hostlist download\n"); | 1720 | "Statistics request failed, scheduling hostlist download\n"); |
1670 | ti_check_download = GNUNET_SCHEDULER_add_now (&task_check, | 1721 | ti_check_download = GNUNET_SCHEDULER_add_now (&task_check, NULL); |
1671 | NULL); | ||
1672 | } | 1722 | } |
1673 | else | 1723 | else |
1674 | { | 1724 | { |
1675 | ti_check_download | 1725 | ti_check_download = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
1676 | = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, | 1726 | &stat_timeout_task, |
1677 | &stat_timeout_task, | 1727 | NULL); |
1678 | NULL); | ||
1679 | } | 1728 | } |
1680 | return GNUNET_OK; | 1729 | return GNUNET_OK; |
1681 | } | 1730 | } |
@@ -1687,8 +1736,7 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | |||
1687 | void | 1736 | void |
1688 | GNUNET_HOSTLIST_client_stop () | 1737 | GNUNET_HOSTLIST_client_stop () |
1689 | { | 1738 | { |
1690 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1739 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hostlist client shutdown\n"); |
1691 | "Hostlist client shutdown\n"); | ||
1692 | if (NULL != sget) | 1740 | if (NULL != sget) |
1693 | { | 1741 | { |
1694 | GNUNET_STATISTICS_get_cancel (sget); | 1742 | GNUNET_STATISTICS_get_cancel (sget); |
@@ -1703,7 +1751,7 @@ GNUNET_HOSTLIST_client_stop () | |||
1703 | ti_saving_task = NULL; | 1751 | ti_saving_task = NULL; |
1704 | } | 1752 | } |
1705 | if (NULL != ti_download_dispatcher_task) | 1753 | if (NULL != ti_download_dispatcher_task) |
1706 | { | 1754 | { |
1707 | GNUNET_SCHEDULER_cancel (ti_download_dispatcher_task); | 1755 | GNUNET_SCHEDULER_cancel (ti_download_dispatcher_task); |
1708 | ti_download_dispatcher_task = NULL; | 1756 | ti_download_dispatcher_task = NULL; |
1709 | } | 1757 | } |