gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16146 - gnunet/src/hostlist


From: gnunet
Subject: [GNUnet-SVN] r16146 - gnunet/src/hostlist
Date: Fri, 22 Jul 2011 22:18:51 +0200

Author: grothoff
Date: 2011-07-22 22:18:51 +0200 (Fri, 22 Jul 2011)
New Revision: 16146

Modified:
   gnunet/src/hostlist/hostlist-client.c
Log:
just indentation / formatting

Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2011-07-22 19:47:02 UTC (rev 
16145)
+++ gnunet/src/hostlist/hostlist-client.c       2011-07-22 20:18:51 UTC (rev 
16146)
@@ -147,6 +147,7 @@
  * How many bytes did we download from the current hostlist URL?
  */
 static uint32_t stat_bytes_downloaded;
+
 /**
  * Amount of time we wait between hostlist downloads.
  */
@@ -263,9 +264,9 @@
  */
 static size_t
 callback_download (void *ptr, 
-                            size_t size, 
-                            size_t nmemb, 
-                            void *ctx)
+                  size_t size, 
+                  size_t nmemb, 
+                  void *ctx)
 {
   static char download_buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
   const char * cbuf = ptr;
@@ -462,7 +463,8 @@
     current_hostlist = NULL;
     return get_bootstrap_server();
   }
-  index = GNUNET_CRYPTO_random_u32 ( GNUNET_CRYPTO_QUALITY_WEAK, 
linked_list_size);
+  index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 
+                                   linked_list_size);
   counter = 0;
   pos = linked_list_head;
   while ( counter < index )
@@ -479,12 +481,14 @@
 
 #define CURL_EASY_SETOPT(c, a, b) do { ret = curl_easy_setopt(c, a, b); if 
(ret != CURLE_OK) GNUNET_log(GNUNET_ERROR_TYPE_WARNING, _("%s failed at %s:%d: 
`%s'\n"), "curl_easy_setopt", __FILE__, __LINE__, curl_easy_strerror(ret)); } 
while (0)
 
+
 /**
  * Method to save hostlist to a file during hostlist client shutdown
  * @param shutdown set if called because of shutdown, entries in linked list 
will be destroyed
  */
 static void save_hostlist_file ( int shutdown );
 
+
 /**
  * add val2 to val1 with overflow check
  * @param val1 value 1
@@ -512,7 +516,9 @@
  * @param val2 value 2
  * @return result
  */
-static uint64_t checked_sub (uint64_t val1, uint64_t val2)
+static uint64_t 
+checked_sub (uint64_t val1, 
+            uint64_t val2)
 {
   if ( val1 <= val2)
     return 0;
@@ -566,10 +572,12 @@
 
 
 /**
- * Method to insert a hostlist into the datastore. If datastore contains 
maximum number of elements, the elements with lowest quality is dismissed
+ * Method to insert a hostlist into the datastore. If datastore
+ * contains maximum number of elements, the elements with lowest
+ * quality is dismissed
  */
 static void
-insert_hostlist ( )
+insert_hostlist ()
 {
   struct Hostlist * lowest_quality;
 
@@ -655,15 +663,18 @@
 {
   CURLMcode mret;
 
-  if ( ( stat_testing_hostlist == GNUNET_YES ) && ( GNUNET_NO == 
stat_download_successful) && (NULL != hostlist_to_test))
+  if ( (stat_testing_hostlist == GNUNET_YES) && 
+       (GNUNET_NO == stat_download_successful) &&
+       (NULL != hostlist_to_test))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _("Advertised hostlist with URI `%s' could not be downloaded. 
Advertised URI gets dismissed.\n"),hostlist_to_test->hostlist_uri);
+                _("Advertised hostlist with URI `%s' could not be downloaded. 
Advertised URI gets dismissed.\n"),
+               hostlist_to_test->hostlist_uri);
   }
 
-  if ( stat_testing_hostlist == GNUNET_YES )
+  if (stat_testing_hostlist == GNUNET_YES)
     {
-    stat_testing_hostlist = GNUNET_NO;
+      stat_testing_hostlist = GNUNET_NO;
     }
   if ( NULL != hostlist_to_test)
   {
@@ -700,6 +711,7 @@
   stat_download_in_progress = GNUNET_NO;
 }
 
+
 /**
  * Task that is run when we are ready to receive more data from the hostlist
  * server.
@@ -709,8 +721,9 @@
  */
 static void
 task_download (void *cls,
-             const struct GNUNET_SCHEDULER_TaskContext *tc);
+              const struct GNUNET_SCHEDULER_TaskContext *tc);
 
+
 /**
  * Ask CURL for the select set and then schedule the
  * receiving task with the scheduler.
@@ -785,9 +798,8 @@
  */
 static void
 task_download (void *cls,
-            const struct GNUNET_SCHEDULER_TaskContext *tc)
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-
   int running;
   struct CURLMsg *msg;
   CURLMcode mret;
@@ -824,7 +836,8 @@
       if (stat_bytes_downloaded > MAX_BYTES_PER_HOSTLISTS)
         {
         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                                  _("Download limit of %u bytes exceeded, 
stopping download\n"),MAX_BYTES_PER_HOSTLISTS);
+                   _("Download limit of %u bytes exceeded, stopping 
download\n"),
+                   MAX_BYTES_PER_HOSTLISTS);
         clean_up();
         return;
         }
@@ -833,8 +846,6 @@
        {
          do
            {
-
-
              msg = curl_multi_info_read (multi, &running);
              GNUNET_break (msg != NULL);
              if (msg == NULL)
@@ -860,8 +871,9 @@
                    update_hostlist();
                    if (GNUNET_YES == stat_testing_hostlist)
                     {
-                      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                                        _("Adding successfully tested hostlist 
`%s' datastore.\n"),current_url);
+                      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                                  _("Adding successfully tested hostlist `%s' 
datastore.\n"),
+                                  current_url);
                      insert_hostlist();
                      hostlist_to_test = NULL;
                      stat_testing_hostlist = GNUNET_NO;
@@ -1090,10 +1102,12 @@
                                                NULL);
 }
 
+
 /**
  * This tasks sets hostlist testing to allowed after intervall between to 
testings is reached
- * cls closure
- * tc TaskContext
+ *
+ * @param cls closure
+ * @param tc TaskContext
  */
 static void
 task_testing_intervall_reset (void *cls,
@@ -1110,8 +1124,9 @@
 
 /**
  * Task that writes hostlist entries to a file on a regular base
- * cls closure
- * tc TaskContext
+ *
+ * @param cls closure
+ * @param tc TaskContext
  */
 static void
 task_hostlist_saving (void *cls,
@@ -1132,6 +1147,7 @@
                                                NULL);
 }
 
+
 /**
  * Method called whenever a given peer connects.
  *
@@ -1173,6 +1189,7 @@
                            GNUNET_NO);
 }
 
+
 /**
  * Method called whenever an advertisement message arrives.
  *
@@ -1536,8 +1553,8 @@
               _("Hostlists will be saved to file again in  %llums\n"),
               (unsigned long long) SAVING_INTERVALL.rel_value);
     ti_saving_task = GNUNET_SCHEDULER_add_delayed (SAVING_INTERVALL,
-                                               &task_hostlist_saving,
-                                               NULL);
+                                                  &task_hostlist_saving,
+                                                  NULL);
   }
   else
   {
@@ -1554,10 +1571,12 @@
         result = remove (filename);
         if (result == 0)
         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              _("Since learning is not enabled on this peer, hostlist file 
`%s' was removed\n"),filename);
+                   _("Since learning is not enabled on this peer, hostlist 
file `%s' was removed\n"),
+                   filename);
         else
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _("Hostlist file `%s' could not be removed\n"),filename);
+                     _("Hostlist file `%s' could not be removed\n"),
+                     filename);
       }
     }
     GNUNET_free ( filename );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]