aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-08-15 13:51:03 +0000
committerChristian Grothoff <christian@grothoff.org>2010-08-15 13:51:03 +0000
commitee7d47da638c7bb1d90b933522f891a7439d7c87 (patch)
tree983a153833b8b14b24dafdcf004269d8b19b489d /src/hostlist
parentcc9ba5958b7e82b9ed39343c658d2ccd019175d4 (diff)
downloadgnunet-ee7d47da638c7bb1d90b933522f891a7439d7c87.tar.gz
gnunet-ee7d47da638c7bb1d90b933522f891a7439d7c87.zip
nitpicks
Diffstat (limited to 'src/hostlist')
-rw-r--r--src/hostlist/hostlist-client.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c
index b4d86e052..e080fdccd 100644
--- a/src/hostlist/hostlist-client.c
+++ b/src/hostlist/hostlist-client.c
@@ -149,7 +149,7 @@ static CURL *curl;
149static CURLM *multi; 149static CURLM *multi;
150 150
151/** 151/**
152 * 152 * How many bytes did we download from the current hostlist URL?
153 */ 153 */
154static uint32_t stat_bytes_downloaded; 154static uint32_t stat_bytes_downloaded;
155/** 155/**
@@ -574,39 +574,32 @@ linked_list_get_lowest_quality ( )
574 * Method to insert a hostlist into the datastore. If datastore contains maximum number of elements, the elements with lowest quality is dismissed 574 * Method to insert a hostlist into the datastore. If datastore contains maximum number of elements, the elements with lowest quality is dismissed
575 */ 575 */
576static void 576static void
577insert_hostlist ( void ) 577insert_hostlist ( )
578{ 578{
579 GNUNET_CONTAINER_DLL_insert(linked_list_head, linked_list_tail, hostlist_to_test); 579 struct Hostlist * lowest_quality;
580 linked_list_size++;
581
582 GNUNET_STATISTICS_set (stats,
583 gettext_noop("# advertised hostlist URIs"),
584 linked_list_size,
585 GNUNET_NO);
586
587 if (MAX_NUMBER_HOSTLISTS >= linked_list_size)
588 return;
589
590 /* No free entries available, replace existing entry */
591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
592 "Removing lowest quality entry\n" );
593 struct Hostlist * lowest_quality = linked_list_get_lowest_quality();
594 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
595 "Hostlist with URI `%s' has the worst quality of all with value %llu\n",
596 lowest_quality->hostlist_uri,
597 (unsigned long long) lowest_quality->quality);
598 GNUNET_CONTAINER_DLL_remove (linked_list_head, linked_list_tail, lowest_quality);
599 linked_list_size--;
600 580
581 if (MAX_NUMBER_HOSTLISTS <= linked_list_size)
582 {
583 /* No free entries available, replace existing entry */
584 lowest_quality = linked_list_get_lowest_quality();
585 GNUNET_assert (lowest_quality != NULL);
586 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
587 "Removing hostlist with URI `%s' which has the worst quality of all (%llu)\n",
588 lowest_quality->hostlist_uri,
589 (unsigned long long) lowest_quality->quality);
590 GNUNET_CONTAINER_DLL_remove (linked_list_head, linked_list_tail, lowest_quality);
591 linked_list_size--;
592 GNUNET_free (lowest_quality);
593 }
594 GNUNET_CONTAINER_DLL_insert(linked_list_head,
595 linked_list_tail,
596 hostlist_to_test);
597 linked_list_size++;
601 GNUNET_STATISTICS_set (stats, 598 GNUNET_STATISTICS_set (stats,
602 gettext_noop("# advertised hostlist URIs"), 599 gettext_noop("# advertised hostlist URIs"),
603 linked_list_size, 600 linked_list_size,
604 GNUNET_NO); 601 GNUNET_NO);
605
606 GNUNET_free (lowest_quality);
607
608 stat_testing_hostlist = GNUNET_NO; 602 stat_testing_hostlist = GNUNET_NO;
609 return;
610} 603}
611 604
612 605