gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35187 - in gnunet/src: ats include


From: gnunet
Subject: [GNUnet-SVN] r35187 - in gnunet/src: ats include
Date: Sun, 8 Feb 2015 23:58:14 +0100

Author: grothoff
Date: 2015-02-08 23:58:14 +0100 (Sun, 08 Feb 2015)
New Revision: 35187

Modified:
   gnunet/src/ats/gnunet-service-ats_connectivity.c
   gnunet/src/ats/plugin_ats_proportional.c
   gnunet/src/ats/test_ats_solver_add_address.c
   gnunet/src/include/gnunet_ats_service.h
Log:
-fin, mention future work in TODO

Modified: gnunet/src/ats/gnunet-service-ats_connectivity.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_connectivity.c    2015-02-08 22:46:45 UTC 
(rev 35186)
+++ gnunet/src/ats/gnunet-service-ats_connectivity.c    2015-02-08 22:58:14 UTC 
(rev 35187)
@@ -41,6 +41,8 @@
    * Client that made the request.
    */
   struct GNUNET_SERVER_Client *client;
+
+  /* TODO: allow client to express a 'strength' for this request */
 };
 
 
@@ -62,6 +64,7 @@
 GAS_connectivity_has_peer (void *cls,
                            const struct GNUNET_PeerIdentity *peer)
 {
+  /* TODO: return sum of 'strength's of connectivity requests */
   return GNUNET_CONTAINER_multipeermap_contains (connection_requests,
                                                  peer);
 }

Modified: gnunet/src/ats/plugin_ats_proportional.c
===================================================================
--- gnunet/src/ats/plugin_ats_proportional.c    2015-02-08 22:46:45 UTC (rev 
35186)
+++ gnunet/src/ats/plugin_ats_proportional.c    2015-02-08 22:58:14 UTC (rev 
35187)
@@ -1062,16 +1062,10 @@
                             net->stat_total,
                             1,
                             GNUNET_NO);
-  if (0 !=
-      s->env->get_connectivity (s->env->cls,
-                                &address->peer))
-  {
-    /* This peer is requested, find best address */
-    update_active_address (s,
-                           get_active_address (s,
-                                               &address->peer),
-                           &address->peer);
-  }
+  update_active_address (s,
+                         get_active_address (s,
+                                             &address->peer),
+                         &address->peer);
   LOG (GNUNET_ERROR_TYPE_INFO,
        "Added new address for `%s', now total %u and active %u addresses in 
network `%s'\n",
        GNUNET_i2s (&address->peer),

Modified: gnunet/src/ats/test_ats_solver_add_address.c
===================================================================
--- gnunet/src/ats/test_ats_solver_add_address.c        2015-02-08 22:46:45 UTC 
(rev 35186)
+++ gnunet/src/ats/test_ats_solver_add_address.c        2015-02-08 22:58:14 UTC 
(rev 35187)
@@ -81,8 +81,11 @@
 
 
 static int
-stat_cb(void *cls, const char *subsystem, const char *name, uint64_t value,
-        int is_persistent);
+stat_cb (void *cls,
+         const char *subsystem,
+         const char *name,
+         uint64_t value,
+         int is_persistent);
 
 
 static void
@@ -90,7 +93,7 @@
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n");
 
-  if (die_task != NULL)
+  if (NULL != die_task)
   {
     GNUNET_SCHEDULER_cancel (die_task);
     die_task = NULL;
@@ -108,9 +111,7 @@
     GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
     stats = NULL;
   }
-
   free_test_address (&test_addr);
-
   ret = 0;
 }
 
@@ -132,19 +133,23 @@
                     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion 
callback!\n");
-  GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+  /* ignored in this test */
 }
 
 
 static int
-stat_cb(void *cls, const char *subsystem,
-        const char *name, uint64_t value,
-        int is_persistent)
+stat_cb (void *cls,
+         const char *subsystem,
+         const char *name,
+         uint64_t value,
+         int is_persistent)
 {
 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n",
-      subsystem,name, value);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "ATS statistics: `%s' `%s' %llu\n",
+              subsystem,
+              name,
+              value);
   if (1 == value)
   {
     GNUNET_SCHEDULER_add_now (&end, NULL);
@@ -152,9 +157,11 @@
   return GNUNET_OK;
 }
 
+
 static void
-run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
-    struct GNUNET_TESTING_Peer *peer)
+run (void *cls,
+     const struct GNUNET_CONFIGURATION_Handle *mycfg,
+     struct GNUNET_TESTING_Peer *peer)
 {
   die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
   stats = GNUNET_STATISTICS_create ("ats", mycfg);
@@ -163,9 +170,10 @@
 
   /* Connect to ATS scheduling */
   sched_ats = GNUNET_ATS_scheduling_init (mycfg, &address_suggest_cb, NULL);
-  if (sched_ats == NULL)
+  if (NULL == sched_ats)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS 
scheduling!\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Could not connect to ATS scheduling!\n");
     GNUNET_SCHEDULER_add_now (&end_badly, NULL);
     return;
   }

Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h     2015-02-08 22:46:45 UTC (rev 
35186)
+++ gnunet/src/include/gnunet_ats_service.h     2015-02-08 22:58:14 UTC (rev 
35187)
@@ -321,8 +321,9 @@
  *
  * @param ch handle
  * @param peer identity of the peer we need an address for
+ * TODO: add argument to allow client to express 'strength's of request
  * @return suggestion handle, NULL if request is already pending
- */
+  */
 struct GNUNET_ATS_ConnectivitySuggestHandle *
 GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
                                  const struct GNUNET_PeerIdentity *peer);




reply via email to

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