gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r386 - in GNUnet: . src/applications src/applications/adver


From: grothoff
Subject: [GNUnet-SVN] r386 - in GNUnet: . src/applications src/applications/advertising src/applications/datastore src/applications/fs/module src/applications/topology_default
Date: Sun, 6 Mar 2005 02:23:09 -0800 (PST)

Author: grothoff
Date: 2005-03-06 02:23:08 -0800 (Sun, 06 Mar 2005)
New Revision: 386

Modified:
   GNUnet/src/applications/OVERVIEW
   GNUnet/src/applications/advertising/bootstrap.c
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/todo
Log:
bootstrap improvements, minor bugfixes

Modified: GNUnet/src/applications/OVERVIEW
===================================================================
--- GNUnet/src/applications/OVERVIEW    2005-03-06 09:55:24 UTC (rev 385)
+++ GNUnet/src/applications/OVERVIEW    2005-03-06 10:23:08 UTC (rev 386)
@@ -1,29 +1,28 @@
 Dependencies for 'core' modules (must be cycle-free!):
 
-advertising->transport
+advertising->bootstrap
 advertising->identity
-advertising->topology
 advertising->pingpong
+advertising->transport
+advertising->topology
 
 core->fragmentation
 core->identity
 core->topology
 core->transport
 
-session->transport
 session->identity
 session->pingpong
+session->transport
 session->topology
 
 pingpong->identity
 pingpong->transport
 
-topology_default->bootstrap
 topology_default->identity
 topology_default->pingpong
 topology_default->transport
 
-topology_f2f->bootstrap
 topology_f2f->identity
 topology_f2f->pingpong
 topology_f2f->transport

Modified: GNUnet/src/applications/advertising/bootstrap.c
===================================================================
--- GNUnet/src/applications/advertising/bootstrap.c     2005-03-06 09:55:24 UTC 
(rev 385)
+++ GNUnet/src/applications/advertising/bootstrap.c     2005-03-06 10:23:08 UTC 
(rev 386)
@@ -117,14 +117,52 @@
         HELO_Message_size(helo));
 }
 
+#define BOOTSTRAP_INFO "bootstrap-info"
+
 static int needBootstrap() {
-  /* FIXME: better do it based on % connections with
-     respect to connection table size... */
-  /* Maybe it should ALSO be based on how many peers
-     we know (identity).  
-     Sure, in the end it goes to the topology, so
-     probably that API should be extended here... */
-  return (coreAPI->forAllConnectedNodes(NULL, NULL) < 4);  
+  static cron_t lastTest;
+  static cron_t delta;
+  cron_t now;
+  char * data;
+
+  cronTime(&now);
+  if (coreAPI->forAllConnectedNodes(NULL, NULL) > 4) {
+    /* still change delta and lastTest; even
+       if the peer _briefly_ drops below 4 
+       connections, we don't want it to immediately
+       go for the hostlist... */
+    delta = 5 * cronMINUTES;
+    lastTest = now;
+    return NO;
+  }
+  if (lastTest == 0) {
+    /* first run in this process */
+    if (-1 != stateReadContent(BOOTSTRAP_INFO,
+                              (void**)&data)) {
+      /* but not first on this machine */
+      lastTest = cronTime(&now);
+      delta = 2 * cronMINUTES; /* wait 2 minutes */
+      FREE(data);
+    } else {
+      /* first on this machine, too! */
+      stateWriteContent(BOOTSTRAP_INFO,
+                       1,
+                       "X");
+      delta = 60 * cronSECONDS;
+    }
+  }
+  if (now - lastTest > delta) {
+    lastTest = now;
+    delta *= 2; /* exponential back-off */
+    /* Maybe it should ALSO be based on how many peers
+       we know (identity).  
+       Sure, in the end it goes to the topology, so
+       probably that API should be extended here... */
+    return YES;
+  } else {
+    /* wait a bit longer */
+    return NO;
+  }
 }
 
 static void processThread(void * unused) {

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2005-03-06 09:55:24 UTC 
(rev 385)
+++ GNUnet/src/applications/datastore/datastore.c       2005-03-06 10:23:08 UTC 
(rev 386)
@@ -361,8 +361,6 @@
  * Update Datastore.  Currently only re-builds the bloomfilter.
  * At some point we'll want to add code to convert data between
  * different sqstore's here, too.
- *
- * @return SYSERR on errors
  */
 void update_module_datastore(UpdateAPI * uapi) {
   int quota;

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2005-03-06 09:55:24 UTC (rev 
385)
+++ GNUnet/src/applications/fs/module/fs.c      2005-03-06 10:23:08 UTC (rev 
386)
@@ -1057,11 +1057,12 @@
 
 /**
  * Update FS module.
- *
- * @return SYSERR on errors
  */
 void update_module_fs(UpdateAPI * uapi) {
   uapi->updateModule("datastore");
+  uapi->updateModule("dht");
+  uapi->updateModule("gap");
+  uapi->updateModule("traffic");
 }
 
 /* end of fs.c */

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2005-03-06 09:55:24 UTC 
(rev 385)
+++ GNUnet/src/applications/topology_default/topology.c 2005-03-06 10:23:08 UTC 
(rev 386)
@@ -37,8 +37,8 @@
 #include "platform.h"
 #include "gnunet_core.h"
 #include "gnunet_protocols.h"
+#include "gnunet_identity_service.h"
 #include "gnunet_topology_service.h"
-#include "gnunet_identity_service.h"
 #include "gnunet_transport_service.h"
 #include "gnunet_pingpong_service.h"
 
@@ -254,13 +254,16 @@
   return saturation;
 }
 
-static int allowConnection(const PeerIdentity peer) {
+static int allowConnection(const PeerIdentity * peer) {
   return OK; /* allow everything */
 }
 
+#define TOPOLOGY_TAG_FILE "topology-070"
+
 Topology_ServiceAPI * 
 provide_module_topology_default(CoreAPIForApplication * capi) {
   static Topology_ServiceAPI api;
+  char * data;
 
   coreAPI = capi;
   identity = capi->requestService("identity");
@@ -290,6 +293,32 @@
             5 * cronSECONDS,
             NULL);
 
+  if (-1 == stateReadContent(TOPOLOGY_TAG_FILE,
+                            (void**) &data)) {
+    stateWriteContent(TOPOLOGY_TAG_FILE,
+                     strlen(PACKAGE_VERSION),
+                     PACKAGE_VERSION);    
+  } else {
+    if (0 != strcmp(PACKAGE_VERSION,
+                   data)) {
+      LOG(LOG_FAILURE,
+         _("Version mismatch ('%s' vs. '%s'), run gnunet-update!\n"),
+         PACKAGE_VERSION,
+         data);
+      FREE(data);
+      BREAK();
+      delCronJob(&cronCheckLiveness,
+                5 * cronSECONDS,
+                NULL);
+      capi->releaseService(identity);
+      identity = NULL;
+      capi->releaseService(transport);
+      transport = NULL;
+      return NULL;
+    }
+    FREE(data);
+  }
+
   api.estimateNetworkSize = &estimateNetworkSize;
   api.getSaturation = &estimateSaturation;
   api.allowConnectionFrom = &allowConnection;
@@ -310,6 +339,18 @@
   return OK;
 }
 
+/**
+ * Update topology module.
+ */
+void update_module_topology_default(UpdateAPI * uapi) {
+  stateUnlinkFromDB(TOPOLOGY_TAG_FILE);
+  uapi->updateModule("identity");
+  uapi->updateModule("transport");
+  uapi->updateModule("pingpong");
+}
+
+
+
 static CoreAPIForApplication * myCapi;
 static Topology_ServiceAPI * myTopology;
 

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-03-06 09:55:24 UTC (rev 385)
+++ GNUnet/todo 2005-03-06 10:23:08 UTC (rev 386)
@@ -11,8 +11,6 @@
   * gnunet-pseudonym
 - gnunet-search:
   * multiple search results don't work (yet); test on sqlite, FSLIB and ECRS 
levels!
-- topology:
-  * do aggressive bootstrap on first start (Christian) [ easy ]
 - gap:
   * economy for local queries (see applications/gap/TODO) [ tricky ]
 - FSUI:





reply via email to

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