gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 26/40: Peerstore: Fixed bug in bootstrap code


From: gnunet
Subject: [gnunet] 26/40: Peerstore: Fixed bug in bootstrap code
Date: Thu, 05 Oct 2023 08:57:29 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 3bd35e8e0c56e5fd9246c7d61b197a716db441d8
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Tue Oct 3 11:15:18 2023 +0200

    Peerstore: Fixed bug in bootstrap code
---
 src/peerstore/gnunet-service-peerstore.c | 81 +++++++++++++++++++-------------
 1 file changed, 48 insertions(+), 33 deletions(-)

diff --git a/src/peerstore/gnunet-service-peerstore.c 
b/src/peerstore/gnunet-service-peerstore.c
index 052656280..06333afeb 100644
--- a/src/peerstore/gnunet-service-peerstore.c
+++ b/src/peerstore/gnunet-service-peerstore.c
@@ -558,17 +558,29 @@ hosts_directory_scan_callback (void *cls, const char 
*fullname)
   struct GNUNET_HELLO_Builder *builder;
   struct GNUNET_PeerIdentity *pid;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "1 hosts_directory_scan_callback filename %s\n",
+              fullname);
+
   if (GNUNET_YES != GNUNET_DISK_file_test (fullname))
     return GNUNET_OK; /* ignore non-files */
 
-  filename = strrchr (fullname, DIR_SEPARATOR);
-  if ((NULL == filename) || (1 > strlen (filename)))
-    filename = fullname;
-  else
-    filename++;
-
-  if (GNUNET_YES != GNUNET_DISK_file_test (filename))
-    return GNUNET_OK;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "2 hosts_directory_scan_callback filename %s\n",
+              fullname);
+  
+  /* filename = strrchr (fullname, DIR_SEPARATOR); */
+  /* if ((NULL == filename) || (1 > strlen (filename))) */
+  /*   filename = fullname; */
+  /* else */
+  /*   filename++; */
+
+  /* GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, */
+  /*             "3 hosts_directory_scan_callback filename %s\n", */
+  /*             filename); */
+  
+  /* if (GNUNET_YES != GNUNET_DISK_file_test (filename)) */
+  /*   return GNUNET_OK; */
   size_total = GNUNET_DISK_fn_read (fullname, buffer, sizeof(buffer));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Read %d bytes from `%s'\n",
@@ -624,31 +636,7 @@ run (void *cls,
   in_shutdown = GNUNET_NO;
   num_clients = 0;
   cfg = c;
-  use_included = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                       "peerinfo",
-                                                       "USE_INCLUDED_HELLOS");
-  if (GNUNET_SYSERR == use_included)
-    use_included = GNUNET_NO;
-  if (GNUNET_YES == use_included)
-  {
-    ip = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
-    GNUNET_asprintf (&peerdir, "%shellos", ip);
-    GNUNET_free (ip);
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Importing HELLOs from `%s'\n"),
-                peerdir);
-
-    GNUNET_DISK_directory_scan (peerdir,
-                                &hosts_directory_scan_callback,
-                                NULL);
-    GNUNET_free (peerdir);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Skipping import of included HELLOs\n"));
-  }
+  
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
                                                           "peerstore",
                                                           "DATABASE",
@@ -673,6 +661,33 @@ run (void *cls,
   }
   watchers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
   expire_task = GNUNET_SCHEDULER_add_now (&cleanup_expired_records, NULL);
+
+  use_included = GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                                       "peerstore",
+                                                       "USE_INCLUDED_HELLOS");
+  if (GNUNET_SYSERR == use_included)
+    use_included = GNUNET_NO;
+  if (GNUNET_YES == use_included)
+  {
+    ip = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+    GNUNET_asprintf (&peerdir, "%shellos", ip);
+    GNUNET_free (ip);
+
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                _ ("Importing HELLOs from `%s'\n"),
+                peerdir);
+
+    GNUNET_DISK_directory_scan (peerdir,
+                                &hosts_directory_scan_callback,
+                                NULL);
+    GNUNET_free (peerdir);
+  }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                _ ("Skipping import of included HELLOs\n"));
+  }
+
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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