gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5252 - in GNUnet/src: applications/topology_default applic


From: gnunet
Subject: [GNUnet-SVN] r5252 - in GNUnet/src: applications/topology_default applications/topology_f2f include util/config_impl util/os
Date: Fri, 6 Jul 2007 22:52:38 -0600 (MDT)

Author: grothoff
Date: 2007-07-06 22:52:38 -0600 (Fri, 06 Jul 2007)
New Revision: 5252

Modified:
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/src/applications/topology_f2f/topology.c
   GNUnet/src/include/gnunet_util_config.h
   GNUnet/src/util/config_impl/impl.c
   GNUnet/src/util/os/statuscalls.c
Log:
fixing f2f topology

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2007-07-07 04:44:36 UTC 
(rev 5251)
+++ GNUnet/src/applications/topology_default/topology.c 2007-07-07 04:52:38 UTC 
(rev 5252)
@@ -419,10 +419,10 @@
     return NULL;
   }
   cron_add_job(capi->cron,
-         &cronCheckLiveness,
-         LIVE_SCAN_FREQUENCY,
-         LIVE_SCAN_FREQUENCY,
-         NULL);
+              &cronCheckLiveness,
+              LIVE_SCAN_FREQUENCY,
+              LIVE_SCAN_FREQUENCY,
+              NULL);
   api.estimateNetworkSize = &estimateNetworkSize;
   api.getSaturation = &estimateSaturation;
   api.allowConnectionFrom = &allowConnection;

Modified: GNUnet/src/applications/topology_f2f/topology.c
===================================================================
--- GNUnet/src/applications/topology_f2f/topology.c     2007-07-07 04:44:36 UTC 
(rev 5251)
+++ GNUnet/src/applications/topology_f2f/topology.c     2007-07-07 04:52:38 UTC 
(rev 5252)
@@ -340,11 +340,14 @@
   return saturation;
 }
 
+/**
+ * @return 0 on success.
+ */
 static int rereadConfiguration(void * ctx,
-                      struct GC_Configuration * cfg,
-                      struct GE_Context * ectx,
-                      const char * section,
-                      const char * option) {
+                              struct GC_Configuration * cfg,
+                              struct GE_Context * ectx,
+                              const char * section,
+                              const char * option) {
   char * fn;
   char * data;
   unsigned long long size;
@@ -353,7 +356,7 @@
   HashCode512 hc;
 
   if (0 != strcmp(section, "F2F"))
-    return OK;
+    return 0;
   GROW(friends,
        friendCount,
        0);
@@ -366,18 +369,18 @@
   if ( (0 == disk_file_test(ectx, fn)) ||
        (OK != disk_file_size(ectx, fn, &size, YES)) ) {
     GE_LOG(ectx,
-     GE_USER | GE_ADMIN | GE_ERROR | GE_IMMEDIATE,
-     "Could not read friends list `%s'\n",
-     fn);
+          GE_USER | GE_ADMIN | GE_ERROR | GE_IMMEDIATE,
+          "Could not read friends list `%s'\n",
+          fn);
     FREE(fn);
     return SYSERR;
   }
   data = MALLOC(size);
   if (size != disk_file_read(ectx, fn, size, data)) {
     GE_LOG(ectx,
-     GE_ERROR | GE_BULK | GE_USER,
-     _("Failed to read friends list from `%s'\n"),
-     fn);
+          GE_ERROR | GE_BULK | GE_USER,
+          _("Failed to read friends list from `%s'\n"),
+          fn);
     FREE(fn);
     FREE(data);
     return SYSERR;
@@ -393,8 +396,8 @@
      sizeof(EncName));
     if (! isspace(enc.encoding[sizeof(EncName)-1])) {
       GE_LOG(ectx,
-       GE_WARNING | GE_BULK | GE_USER,
-       _("Syntax error in topology specification, skipping bytes.\n"));
+            GE_WARNING | GE_BULK | GE_USER,
+            _("Syntax error in topology specification, skipping bytes.\n"));
       continue;
     }
     enc.encoding[sizeof(EncName)-1] = '\0';
@@ -406,16 +409,16 @@
       friends[friendCount-1].hashPubKey = hc;
     } else {
       GE_LOG(ectx,
-       GE_WARNING | GE_BULK | GE_USER,
-       _("Syntax error in topology specification, skipping bytes `%s'.\n"),
-       &enc);
+            GE_WARNING | GE_BULK | GE_USER,
+            _("Syntax error in topology specification, skipping bytes 
`%s'.\n"),
+            &enc);
     }
     pos = pos + sizeof(EncName);
     while ( (pos < size) &&
-      isspace(data[pos]))
+           isspace(data[pos]))
       pos++;
   }
-  return OK;
+  return 0;
 }
 
 Topology_ServiceAPI *
@@ -446,8 +449,9 @@
     return NULL;
   }
   if (0 != GC_attach_change_listener(coreAPI->cfg,
-                            &rereadConfiguration,
-                            NULL)) {
+                                    &rereadConfiguration,
+                                    NULL)) {
+    GE_BREAK(ectx, 0);
     capi->releaseService(identity);
     identity = NULL;
     capi->releaseService(transport);
@@ -458,10 +462,10 @@
   }
 
   cron_add_job(coreAPI->cron,
-         &cronCheckLiveness,
-         LIVE_SCAN_FREQUENCY,
-         LIVE_SCAN_FREQUENCY,
-         NULL);
+              &cronCheckLiveness,
+              LIVE_SCAN_FREQUENCY,
+              LIVE_SCAN_FREQUENCY,
+              NULL);
   api.estimateNetworkSize = &estimateNetworkSize;
   api.getSaturation = &estimateSaturation;
   api.allowConnectionFrom = &allowConnection;

Modified: GNUnet/src/include/gnunet_util_config.h
===================================================================
--- GNUnet/src/include/gnunet_util_config.h     2007-07-07 04:44:36 UTC (rev 
5251)
+++ GNUnet/src/include/gnunet_util_config.h     2007-07-07 04:52:38 UTC (rev 
5252)
@@ -231,9 +231,6 @@
  * Attach a callback that is notified whenever a
  * configuration option changes.<p>
  *
- * TODO: also call callback on existing configuration and confirm
- * existing configuration is OK!  If not, return error!
- *
  * @return 0 on success, -1 on error
  */
 int GC_attach_change_listener(struct GC_Configuration * cfg,

Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c  2007-07-07 04:44:36 UTC (rev 5251)
+++ GNUnet/src/util/config_impl/impl.c  2007-07-07 04:52:38 UTC (rev 5252)
@@ -844,12 +844,12 @@
     for (j=0;j<s->size;j++) {
       GC_Entry * e = &s->entries[j];
       if (0 != callback(ctx,
-               cfg,
-               cfg->data->ectx,
-               s->name,
-               e->key)) {
-  MUTEX_UNLOCK(cfg->data->lock);
-  return -1;
+                       cfg,
+                       cfg->data->ectx,
+                       s->name,
+                       e->key)) {
+       MUTEX_UNLOCK(cfg->data->lock);
+       return -1;
       }
       s = &cfg->data->sections[i]; /* side-effects of callback are possible! */
     }

Modified: GNUnet/src/util/os/statuscalls.c
===================================================================
--- GNUnet/src/util/os/statuscalls.c    2007-07-07 04:44:36 UTC (rev 5251)
+++ GNUnet/src/util/os/statuscalls.c    2007-07-07 04:52:38 UTC (rev 5252)
@@ -347,6 +347,9 @@
   int numInterfaces;
   int basic;
 
+  if (0 != strcmp(sect,
+                 "LOAD"))
+    return 0; /* fast path */
   basic = GC_get_configuration_value_yesno(cfg,
                                   "LOAD",
                                   "BASICLIMITING",





reply via email to

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