gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11020 - gnunet/src/hostlist
Date: Thu, 22 Apr 2010 10:44:53 +0200

Author: wachs
Date: 2010-04-22 10:44:53 +0200 (Thu, 22 Apr 2010)
New Revision: 11020

Modified:
   gnunet/src/hostlist/hostlist-client.c
Log:


Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2010-04-22 08:29:36 UTC (rev 
11019)
+++ gnunet/src/hostlist/hostlist-client.c       2010-04-22 08:44:53 UTC (rev 
11020)
@@ -330,7 +330,6 @@
 get_bootstrap_url ()
 {
   char *servers;
-  char *ret;
   size_t urls;
   size_t pos;
 
@@ -383,9 +382,8 @@
         }
       pos--;    
     }
-  ret = GNUNET_strdup (&servers[pos]);
   GNUNET_free (servers);
-  return ret;
+  return GNUNET_strdup (&servers[pos]);
 }
 
 /**
@@ -1168,7 +1166,6 @@
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _("No `%s' specified in `%s' configuration, cannot load 
hostlists from file.\n"),
                   "HOSTLISTFILE", "HOSTLIST");
-      GNUNET_free ( filename );
       return;
     }
 
@@ -1178,7 +1175,7 @@
   {
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 _("Hostlist file `%s' is not existing\n"), filename);
-    if ( NULL != filename ) GNUNET_free ( filename );
+    GNUNET_free ( filename );
     return;
   }
 
@@ -1189,7 +1186,7 @@
                   _("Could not open file `%s' for reading to load hostlists: 
%s\n"), 
                  filename,
                  STRERROR (errno));
-      if ( NULL != filename ) GNUNET_free (filename);
+      GNUNET_free (filename);
       return;
     }
 
@@ -1239,7 +1236,7 @@
 
 
 /**
- * Method to load persistent hostlist file during hostlist client shutdown
+ * Method to save persistent hostlist 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 )
@@ -1259,7 +1256,6 @@
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _("No `%s' specified in `%s' configuration, cannot save 
hostlists to file.\n"),
                   "HOSTLISTFILE", "HOSTLIST");
-                  GNUNET_free (filename);
       return;
     }
   wh = GNUNET_BIO_write_open (filename);
@@ -1269,7 +1265,7 @@
                   _("Could not open file `%s' for writing to save hostlists: 
%s\n"),
                   filename,
                  STRERROR (errno));
-                  GNUNET_free (filename);
+      GNUNET_free (filename);
       return;
     }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1360,18 +1356,16 @@
                                             "HTTP-PROXY", 
                                             &proxy))
     proxy = NULL;
+  learning = learn;
   *ch = &connect_handler;
   *dh = &disconnect_handler;
-  if (learn)
-    *msgh = &advertisement_handler;
-  else
-    *msgh = NULL;
   linked_list_head = NULL;
   linked_list_tail = NULL;
   use_preconfigured_list = GNUNET_YES;
-  learning = learn;
+
   if ( GNUNET_YES == learning )
   {
+    *msgh = &advertisement_handler;
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _("Learning is enabled on this peer\n"));
     load_hostlist_file ();
@@ -1387,6 +1381,7 @@
   {
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _("Learning is not enabled on this peer\n"));
+    *msgh = NULL;
     if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
                                                             "HOSTLIST",
                                                             "HOSTLISTFILE",
@@ -1426,7 +1421,8 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Hostlist client shutdown\n");
 #endif
-  save_hostlist_file ( GNUNET_YES );
+  if ( GNUNET_YES == learning )
+    save_hostlist_file ( GNUNET_YES );
 
   if (current_task != GNUNET_SCHEDULER_NO_TASK)
     {





reply via email to

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