gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11011 - gnunet/src/hostlist
Date: Wed, 21 Apr 2010 16:10:10 +0200

Author: wachs
Date: 2010-04-21 16:10:10 +0200 (Wed, 21 Apr 2010)
New Revision: 11011

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


Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2010-04-21 13:22:48 UTC (rev 
11010)
+++ gnunet/src/hostlist/hostlist-client.c       2010-04-21 14:10:10 UTC (rev 
11011)
@@ -499,7 +499,7 @@
        current_hostlist->times_used++;
        current_hostlist->quality = checked_add ( current_hostlist->quality, 
HOSTLIST_SUCCESSFUL_DOWNLOAD);
        GNUNET_asprintf (&stat,
-                        gettext_noop("Learned URI `%s' downloaded"),
+                        gettext_noop("Advertised URI `%s' downloaded"),
                         current_hostlist->hostlist_uri);
 
        GNUNET_STATISTICS_update ( stats,

Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c       2010-04-21 13:22:48 UTC (rev 
11010)
+++ gnunet/src/hostlist/hostlist-server.c       2010-04-21 14:10:10 UTC (rev 
11011)
@@ -410,7 +410,7 @@
   GNUNET_STATISTICS_set (stats,
                          gettext_noop("# hostlist advertisements send"),
                          hostlist_adv_count,
-                         GNUNET_YES);
+                         GNUNET_NO);
   return transmission_size;
 }
 

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c  2010-04-21 
13:22:48 UTC (rev 11010)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c  2010-04-21 
14:10:10 UTC (rev 11011)
@@ -43,6 +43,7 @@
 
 static int timeout;
 static int adv_arrived;
+static int adv_sent;
 static int learned_hostlist_saved;
 static int learned_hostlist_downloaded;
 
@@ -110,6 +111,7 @@
         check_task);
     check_task = GNUNET_SCHEDULER_NO_TASK;
   }
+  GNUNET_free (current_adv_uri);
   GNUNET_SCHEDULER_add_now (sched,
                             &clean_up, NULL);
 }
@@ -161,6 +163,22 @@
   return GNUNET_OK;
 }
 
+static int
+process_adv_sent (void *cls,
+              const char *subsystem,
+              const char *name,
+              uint64_t value,
+              int is_persistent)
+{
+  if ( (value == 1) && (adv_sent == GNUNET_NO))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                _("Server has successfully sent advertisement\n"));
+    adv_sent = GNUNET_YES;
+  }
+  return GNUNET_OK;
+}
+
 /**
  * Check the server statistics regularly
  */
@@ -169,7 +187,7 @@
 {
   char *stat;
   GNUNET_asprintf (&stat,
-                   gettext_noop("Learned URI `%s' downloaded"),
+                   gettext_noop("Advertised URI `%s' downloaded"),
                    current_adv_uri);
   GNUNET_STATISTICS_get (learn_peer.stats,
                          "hostlist",
@@ -186,6 +204,13 @@
                          NULL,
                          &process_uris_recv,
                          NULL);
+  GNUNET_STATISTICS_get (adv_peer.stats,
+                         "hostlist",
+                         gettext_noop("# hostlist advertisements send"),
+                         GNUNET_TIME_UNIT_MINUTES,
+                         NULL,
+                         &process_adv_sent,
+                         NULL);
   check_task = GNUNET_SCHEDULER_add_delayed (sched,
                                 CHECK_INTERVALL,
                                 &check_statistics,
@@ -318,6 +343,8 @@
 #endif
   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
   GNUNET_ARM_start_services (p->cfg, sched, "core", NULL);
+  p->stats = GNUNET_STATISTICS_create (sched, "hostlist", p->cfg);
+  GNUNET_assert ( NULL != p->stats );
 }
 
 
@@ -392,6 +419,7 @@
 {
   timeout = GNUNET_NO;
   adv_arrived = GNUNET_NO;
+  adv_sent =GNUNET_NO;
   learned_hostlist_downloaded = GNUNET_NO;
   sched = s;
   timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
@@ -453,6 +481,13 @@
                 "Advertisement hostlist could not be downloaded from 
server\n");
     return GNUNET_YES;
   }
+
+  if (adv_sent == GNUNET_NO)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Advertisement was not sent from server to client\n");
+    return GNUNET_YES;
+  }
   return GNUNET_NO;
 }
 





reply via email to

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