gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r11070 - gnunet/src/hostlist
Date: Mon, 26 Apr 2010 17:31:07 +0200

Author: wachs
Date: 2010-04-26 17:31:07 +0200 (Mon, 26 Apr 2010)
New Revision: 11070

Added:
   gnunet/src/hostlist/hostlists_adv_peer.file
   gnunet/src/hostlist/test_learning_learn_peer2.conf
Modified:
   gnunet/src/hostlist/hostlist-client.c
   gnunet/src/hostlist/hostlist-client.h
   gnunet/src/hostlist/hostlist-server.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
   gnunet/src/hostlist/test_learning_adv_peer.conf
   gnunet/src/hostlist/test_learning_learn_peer.conf
Log:


Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2010-04-26 15:25:27 UTC (rev 
11069)
+++ gnunet/src/hostlist/hostlist-client.c       2010-04-26 15:31:07 UTC (rev 
11070)
@@ -252,6 +252,7 @@
  */
 static unsigned int stat_connection_count;
 
+unsigned int downloaded_hellos;
 
 /**
  * Process downloaded bits by calling callback on each HELLO.
@@ -280,6 +281,15 @@
     {
       return total;  /* ok, no data or bogus data */
     }
+
+  if ( downloaded_hellos >= MAX_HELLO_PER_HOSTLISTS )
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  _("Maximum number of HELLO Messages per download reached: 
%u'\n"),
+                  MAX_HELLO_PER_HOSTLISTS );
+    return total;
+
+  }
   GNUNET_STATISTICS_update (stats, 
                            gettext_noop ("# bytes downloaded from hostlist 
servers"), 
                            (int64_t) total, 
@@ -311,7 +321,9 @@
          GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                      _("Invalid `%s' message received from hostlist at 
`%s'\n"),
                      "HELLO",
-                     current_url); 
+                     current_url);
+          stat_hellos_obtained++;
+          downloaded_hellos++;
          stat_bogus_url = 1;
          return total;
        }
@@ -332,6 +344,7 @@
                                    1, 
                                    GNUNET_NO);
          stat_hellos_obtained++;
+         downloaded_hellos++;
          GNUNET_TRANSPORT_offer_hello (transport, msg);
        }
       else
@@ -345,6 +358,8 @@
                      "HELLO",
                      current_url);
          stat_bogus_url = GNUNET_YES;
+          stat_hellos_obtained++;
+          downloaded_hellos++;
          return total;
        }
       memmove (download_buffer,
@@ -674,7 +689,6 @@
     hostlist_to_test = NULL;
   }
 
-
   if (multi != NULL)
     {
       mret = curl_multi_remove_handle (multi, curl);
@@ -700,7 +714,7 @@
     }  
   GNUNET_free_non_null (current_url);
   current_url = NULL;
-
+  downloaded_hellos = 0;
   stat_download_in_progress = GNUNET_NO;
 }
 
@@ -792,7 +806,7 @@
 task_download (void *cls,
             const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  unsigned int counter;
+
   int running;
   struct CURLMsg *msg;
   CURLMcode mret;
@@ -823,7 +837,6 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Ready for processing hostlist client request\n");
 #endif
-  counter = 0;
   do 
     {
       running = 0;
@@ -834,7 +847,6 @@
            {
 
              msg = curl_multi_info_read (multi, &running);
-             counter ++;
              GNUNET_break (msg != NULL);
              if (msg == NULL)
                break;
@@ -855,6 +867,8 @@
                    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                                _("Download of hostlist `%s' completed.\n"),
                                current_url);
+                    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                                      _("HELLOs recieved: %u 
\n"),downloaded_hellos);
                    stat_download_successful = GNUNET_YES;
                    update_hostlist();
                    if (GNUNET_YES == stat_testing_hostlist)
@@ -918,6 +932,7 @@
   stat_download_in_progress = GNUNET_YES;
   stat_download_successful = GNUNET_NO;
   stat_hellos_obtained = 0;
+  downloaded_hellos = 0;
 
   GNUNET_STATISTICS_update (stats, 
                            gettext_noop ("# hostlist downloads initiated"), 

Modified: gnunet/src/hostlist/hostlist-client.h
===================================================================
--- gnunet/src/hostlist/hostlist-client.h       2010-04-26 15:25:27 UTC (rev 
11069)
+++ gnunet/src/hostlist/hostlist-client.h       2010-04-26 15:31:07 UTC (rev 
11070)
@@ -33,7 +33,7 @@
 #include "gnunet_time_lib.h"
 
 #define MAX_NUMBER_HOSTLISTS 30
-#define MAX_HELLO_PER_HOSTLISTS 0
+#define MAX_HELLO_PER_HOSTLISTS 50
 #define SAVING_INTERVALL GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_MINUTES, 30)
 #define TESTING_INTERVALL GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 3)
 #define WAITING_INTERVALL GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 1)

Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c       2010-04-26 15:25:27 UTC (rev 
11069)
+++ gnunet/src/hostlist/hostlist-server.c       2010-04-26 15:31:07 UTC (rev 
11070)
@@ -32,7 +32,7 @@
 #include "gnunet-daemon-hostlist.h"
 #include "gnunet_resolver_service.h"
 
-#define DEBUG_HOSTLIST_SERVER GNUNET_NO
+#define DEBUG_HOSTLIST_SERVER GNUNET_YES
 
 /**
  * How often should we recalculate our response to hostlist requests?
@@ -282,7 +282,6 @@
                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct HostSet *results;
-
   response_task = GNUNET_SCHEDULER_NO_TASK;
   results = GNUNET_malloc(sizeof(struct HostSet));
   GNUNET_assert (peerinfo != NULL);
@@ -438,6 +437,11 @@
 {
   size_t size;
 
+  /* FIXME: Change this way to update the list to peerinfo_notify */
+  response_task = GNUNET_SCHEDULER_add_now (sched,
+                                            &update_response,
+                                            NULL);
+
   if ( !advertising )
     return;
   if (hostlist_uri == NULL)
@@ -455,8 +459,8 @@
       return;
     }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Asked core to transmit advertisement message with a size of %u 
bytes\n", 
-             size);
+              "Asked core to transmit advertisement message with a size of %u 
bytes to peer `%s'\n",
+             size,GNUNET_i2s(peer));
   if (NULL == GNUNET_CORE_notify_transmit_ready (core,
                                                 0,
                                                 GNUNET_ADV_TIMEOUT,

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c  2010-04-26 
15:25:27 UTC (rev 11069)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c  2010-04-26 
15:31:07 UTC (rev 11070)
@@ -71,7 +71,9 @@
 
 static struct PeerContext learn_peer;
 
+static struct PeerContext learn_peer2;
 
+
 static void
 waitpid_task (void *cls,
               const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -137,6 +139,11 @@
     GNUNET_TRANSPORT_disconnect (learn_peer.th);
     learn_peer.th = NULL;
   }
+  if (learn_peer2.th != NULL)
+  {
+    GNUNET_TRANSPORT_disconnect (learn_peer2.th);
+    learn_peer2.th = NULL;
+  }
   if (adv_peer.core != NULL)
   {
     GNUNET_CORE_disconnect (adv_peer.core);
@@ -147,11 +154,19 @@
     GNUNET_CORE_disconnect (learn_peer.core);
     learn_peer.core = NULL;
   }
+  if (learn_peer2.core != NULL)
+  {
+    GNUNET_CORE_disconnect (learn_peer2.core);
+    learn_peer2.core = NULL;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Asking ARM to stop core services\n");
   learn_peer.arm = GNUNET_ARM_connect (learn_peer.cfg, sched, NULL);
   GNUNET_ARM_stop_service (learn_peer.arm, "core", GNUNET_TIME_UNIT_SECONDS,
                            &stop_cb, &learn_peer);
+  learn_peer2.arm = GNUNET_ARM_connect (learn_peer2.cfg, sched, NULL);
+  GNUNET_ARM_stop_service (learn_peer2.arm, "core", GNUNET_TIME_UNIT_SECONDS,
+                           &stop_cb, &learn_peer2);
   adv_peer.arm = GNUNET_ARM_connect (adv_peer.cfg, sched, NULL);
   GNUNET_ARM_stop_service (adv_peer.arm, "core", GNUNET_TIME_UNIT_SECONDS,
                            &stop_cb, &adv_peer);
@@ -415,6 +430,8 @@
 
   setup_adv_peer (&adv_peer, "test_learning_adv_peer.conf");
   setup_learn_peer (&learn_peer, "test_learning_learn_peer.conf");
+  setup_learn_peer (&learn_peer2, "test_learning_learn_peer2.conf");
+
 }
 
 

Modified: gnunet/src/hostlist/test_learning_adv_peer.conf
===================================================================
--- gnunet/src/hostlist/test_learning_adv_peer.conf     2010-04-26 15:25:27 UTC 
(rev 11069)
+++ gnunet/src/hostlist/test_learning_adv_peer.conf     2010-04-26 15:31:07 UTC 
(rev 11070)
@@ -34,10 +34,11 @@
 WEAKRANDOM = YES
 
 [hostlist]
-HTTPPORT = 12981s
-SERVERS = http://localhost:12980/
-OPTIONS = -b -p -a
-DEBUG = NO
+HTTPPORT = 12981
+SERVERS = http://localhost:12981/
+OPTIONS = -p -a -b -e
+#OPTIONS = -b -p -a
+DEBUG = YES
 HOSTLISTFILE = hostlists_adv_peer.file
 #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
 

Modified: gnunet/src/hostlist/test_learning_learn_peer.conf
===================================================================
--- gnunet/src/hostlist/test_learning_learn_peer.conf   2010-04-26 15:25:27 UTC 
(rev 11069)
+++ gnunet/src/hostlist/test_learning_learn_peer.conf   2010-04-26 15:31:07 UTC 
(rev 11070)
@@ -35,8 +35,9 @@
 [hostlist]
 HTTPPORT = 12980
 SERVERS = http://localhost:12981/
-OPTIONS = -b -p -e
-#DEBUG = YES
+OPTIONS = -b -e
+#OPTIONS = -b -p
+DEBUG = YES
 HOSTLISTFILE = hostlists_learn_peer.file
 #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
 

Added: gnunet/src/hostlist/test_learning_learn_peer2.conf
===================================================================
--- gnunet/src/hostlist/test_learning_learn_peer2.conf                          
(rev 0)
+++ gnunet/src/hostlist/test_learning_learn_peer2.conf  2010-04-26 15:31:07 UTC 
(rev 11070)
@@ -0,0 +1,47 @@
+[PATHS]
+SERVICEHOME = /tmp/test-gnunetd-hostlist-peer-3/
+DEFAULTCONFIG = test_learning_learn_peer2.conf
+[resolver]
+PORT = 32964
+
+[transport]
+PORT = 32965
+PLUGINS = tcp
+#DEBUG = YES
+
+[arm]
+PORT = 32966
+DEFAULTSERVICES = resolver transport core statistics topology hostlist
+#GLOBAL_PREFIX = xterm -e gdb -x cmd --args 
+#DEBUG=NO
+
+[statistics]
+PORT = 32967
+
+[transport-tcp]
+PORT = 32968
+
+[peerinfo]
+PORT = 32969
+
+[core]
+PORT = 32970
+#DEBUG = YES
+#PREFIX = valgrind --tool=memcheck
+
+[testing]
+WEAKRANDOM = YES
+
+[hostlist]
+HTTPPORT = 32980
+SERVERS = http://localhost:12981/
+OPTIONS = -b -e
+#OPTIONS = -b -p
+DEBUG = YES
+HOSTLISTFILE = hostlists_learn_peer2.file
+#BINARY = /home/grothoff/bin/gnunet-daemon-hostlist
+
+
+[topology]
+#DEBUG = YES
+#PREFIX = valgrind --tool=memcheck





reply via email to

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