gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r10611 - gnunet/src/hostlist
Date: Tue, 16 Mar 2010 10:55:26 +0100

Author: grothoff
Date: 2010-03-16 10:55:26 +0100 (Tue, 16 Mar 2010)
New Revision: 10611

Modified:
   gnunet/src/hostlist/gnunet-daemon-hostlist.c
   gnunet/src/hostlist/hostlist-client.c
   gnunet/src/hostlist/hostlist-server.c
Log:
fixes

Modified: gnunet/src/hostlist/gnunet-daemon-hostlist.c
===================================================================
--- gnunet/src/hostlist/gnunet-daemon-hostlist.c        2010-03-16 09:16:51 UTC 
(rev 10610)
+++ gnunet/src/hostlist/gnunet-daemon-hostlist.c        2010-03-16 09:55:26 UTC 
(rev 10611)
@@ -174,10 +174,6 @@
       return;
     }
   stats = GNUNET_STATISTICS_create (sched, "hostlist", cfg);
-  if (learning)
-    {
-      /* FIXME (register handler with core for hostlist ads) */
-    }
   if (bootstrapping)
     {
       GNUNET_HOSTLIST_client_start (cfg, sched, stats,
@@ -187,6 +183,10 @@
     {      
       GNUNET_HOSTLIST_server_start (cfg, sched, stats);
     }
+  if (learning)
+    {
+      /* FIXME (register handler with core for hostlist ads) */
+    }
   core = GNUNET_CORE_connect (sched, cfg,
                              GNUNET_TIME_UNIT_FOREVER_REL,
                              NULL,

Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2010-03-16 09:16:51 UTC (rev 
10610)
+++ gnunet/src/hostlist/hostlist-client.c       2010-03-16 09:55:26 UTC (rev 
10611)
@@ -148,7 +148,8 @@
                            (int64_t) total, 
                            GNUNET_NO);  
   left = total;
-  while (left > 0)
+  while ( (left > 0) ||
+         (download_pos > 0) )
     {
       cpy = GNUNET_MIN (total, GNUNET_SERVER_MAX_MESSAGE_SIZE - download_pos);
       GNUNET_assert (cpy > 0);

Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c       2010-03-16 09:16:51 UTC (rev 
10610)
+++ gnunet/src/hostlist/hostlist-server.c       2010-03-16 09:55:26 UTC (rev 
10611)
@@ -150,6 +150,37 @@
 
 
 /**
+ * Set 'cls' to GNUNET_YES (we have an address!).
+ *
+ * @param cls closure, an 'int*'
+ * @param tname name of the transport (ignored)
+ * @param expiration expiration time (call is ignored if this is in the past)
+ * @param addr the address (ignored)
+ * @param addrlen length of the address (ignored)
+ * @return  GNUNET_SYSERR to stop iterating (unless expiration has occured)
+ */
+static int
+check_has_addr (void *cls,
+               const char *tname,
+               struct GNUNET_TIME_Absolute expiration,
+               const void *addr, size_t addrlen)
+{
+  int *arg = cls;
+
+  if (GNUNET_TIME_absolute_get_remaining (expiration).value == 0)
+    {
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop("expired addresses encountered"),
+                               1,
+                               GNUNET_YES);
+      return GNUNET_YES; /* ignore this address */
+    }
+  *arg = GNUNET_YES;
+  return GNUNET_SYSERR;
+}
+
+
+/**
  * Callback that processes each of the known HELLOs for the
  * hostlist response construction.
  */
@@ -162,6 +193,7 @@
   struct HostSet *results = cls;
   size_t old;
   size_t s;
+  int has_addr;
   
   if (peer == NULL)
     {
@@ -169,6 +201,22 @@
       finish_response (results);
       return;
     }
+  has_addr = GNUNET_NO;
+  GNUNET_HELLO_iterate_addresses (hello,
+                                 GNUNET_NO,
+                                 &check_has_addr,
+                                 &has_addr);
+  if (GNUNET_NO == has_addr)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "HELLO for peer `%4s' has no address, not suitable for 
hostlist!\n",
+                 GNUNET_i2s (peer));
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop("HELLOs without addresses 
encountered (ignored)"),
+                               1,
+                               GNUNET_YES);
+      return; 
+    }
   old = results->size;
   s = GNUNET_HELLO_size(hello);
 #if DEBUG_HOSTLIST_SERVER





reply via email to

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