gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17307 - in gnunet/src: dht fs


From: gnunet
Subject: [GNUnet-SVN] r17307 - in gnunet/src: dht fs
Date: Mon, 10 Oct 2011 13:06:33 +0200

Author: grothoff
Date: 2011-10-10 13:06:33 +0200 (Mon, 10 Oct 2011)
New Revision: 17307

Modified:
   gnunet/src/dht/Makefile.am
   gnunet/src/dht/gnunet-service-dht_neighbours.c
   gnunet/src/fs/Makefile.am
   gnunet/src/fs/gnunet-service-fs_cp.c
Log:
renaming in code to use new ATS pref/reservation API

Modified: gnunet/src/dht/Makefile.am
===================================================================
--- gnunet/src/dht/Makefile.am  2011-10-10 10:59:00 UTC (rev 17306)
+++ gnunet/src/dht/Makefile.am  2011-10-10 11:06:33 UTC (rev 17307)
@@ -44,6 +44,7 @@
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
+  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/transport/libgnunettransport.la \
   $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
   $(top_builddir)/src/hello/libgnunethello.la \

Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c      2011-10-10 10:59:00 UTC 
(rev 17306)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c      2011-10-10 11:06:33 UTC 
(rev 17307)
@@ -32,6 +32,7 @@
 #include "gnunet_constants.h"
 #include "gnunet_protocols.h"
 #include "gnunet_nse_service.h"
+#include "gnunet_ats_service.h"
 #include "gnunet_core_service.h"
 #include "gnunet_datacache_lib.h"
 #include "gnunet_transport_service.h"
@@ -321,7 +322,7 @@
   /**
    * Preference update context
    */
-  struct GNUNET_CORE_InformationRequestContext *info_ctx;
+  struct GNUNET_ATS_InformationRequestContext *info_ctx;
 
   /**
    * Task for scheduling preference updates
@@ -407,12 +408,17 @@
 static struct GNUNET_PeerIdentity my_identity;
 
 /**
- * Handle to GNUnet core.
+ * Handle to CORE.
  */
 static struct GNUNET_CORE_Handle *coreAPI;
 
+/**
+ * Handle to ATS.
+ */
+static struct GNUNET_ATS_Handle *atsAPI;
 
 
+
 /**
  * Find the optimal bucket for this key.
  *
@@ -514,10 +520,10 @@
                            gettext_noop ("# Preference updates given to 
core"), 1,
                            GNUNET_NO);
   peer->info_ctx =
-    GNUNET_CORE_peer_change_preference (coreAPI, &peer->id,
-                                       0,
-                                       preference,
-                                       &update_core_preference_finish, peer);
+    GNUNET_ATS_peer_change_preference (atsAPI, &peer->id,
+                                      0,
+                                      preference,
+                                      &update_core_preference_finish, peer);
 }
 
 
@@ -725,7 +731,7 @@
                                                        to_remove));
   if (NULL != to_remove->info_ctx)
   {
-    GNUNET_CORE_peer_change_preference_cancel (to_remove->info_ctx);
+    GNUNET_ATS_peer_change_preference_cancel (to_remove->info_ctx);
     to_remove->info_ctx = NULL;
   }
   if (GNUNET_SCHEDULER_NO_TASK != to_remove->preference_task)
@@ -2040,6 +2046,7 @@
       GNUNET_CONFIGURATION_get_value_number (GDS_cfg, "DHT", "bucket_size",
                                              &temp_config_num))
     bucket_size = (unsigned int) temp_config_num;  
+  atsAPI = GNUNET_ATS_init (GDS_cfg, NULL, NULL);
   coreAPI = GNUNET_CORE_connect (GDS_cfg,
                                  1,
                                  NULL,
@@ -2067,6 +2074,8 @@
     return;
   GNUNET_CORE_disconnect (coreAPI);
   coreAPI = NULL;    
+  GNUNET_ATS_shutdown (atsAPI);
+  atsAPI = NULL;    
   GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (all_known_peers));
   GNUNET_CONTAINER_multihashmap_destroy (all_known_peers);
   all_known_peers = NULL;

Modified: gnunet/src/fs/Makefile.am
===================================================================
--- gnunet/src/fs/Makefile.am   2011-10-10 10:59:00 UTC (rev 17306)
+++ gnunet/src/fs/Makefile.am   2011-10-10 11:06:33 UTC (rev 17307)
@@ -119,6 +119,7 @@
  $(top_builddir)/src/block/libgnunetblock.la \
  $(top_builddir)/src/datastore/libgnunetdatastore.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+ $(top_builddir)/src/ats/libgnunetats.la \
  $(top_builddir)/src/core/libgnunetcore.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(GN_LIBINTL)

Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c        2011-10-10 10:59:00 UTC (rev 
17306)
+++ gnunet/src/fs/gnunet-service-fs_cp.c        2011-10-10 11:06:33 UTC (rev 
17307)
@@ -25,6 +25,7 @@
  */
 #include "platform.h"
 #include "gnunet_load_lib.h"
+#include "gnunet_ats_service.h"
 #include "gnunet-service-fs.h"
 #include "gnunet-service-fs_cp.h"
 #include "gnunet-service-fs_pe.h"
@@ -240,9 +241,9 @@
   struct GSF_PeerTransmitHandle *migration_pth;
 
   /**
-   * Context of our GNUNET_CORE_peer_change_preference call (or NULL).
+   * Context of our GNUNET_ATS_peer_change_preference call (or NULL).
    */
-  struct GNUNET_CORE_InformationRequestContext *irc;
+  struct GNUNET_ATS_InformationRequestContext *irc;
 
   /**
    * Task scheduled if we need to retry bandwidth reservation later.
@@ -301,6 +302,10 @@
  */
 static char *trustDirectory;
 
+/**
+ * Handle to ATS service.
+ */
+static struct GNUNET_ATS_Handle *ats;
 
 /**
  * Get the filename under which we would store the GNUNET_HELLO_Message
@@ -399,7 +404,7 @@
  *        long should the client wait until re-trying?
  */
 static void
-core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
+ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
                        int32_t amount, struct GNUNET_TIME_Relative res_delay);
 
 
@@ -432,9 +437,9 @@
     ip = cp->inc_preference;
     cp->inc_preference = 0;
     cp->irc =
-        GNUNET_CORE_peer_change_preference (GSF_core, &target,
-                                            DBLOCK_SIZE, ip,
-                                            &core_reserve_callback, cp);
+        GNUNET_ATS_peer_change_preference (ats, &target,
+                                          DBLOCK_SIZE, ip,
+                                          &ats_reserve_callback, cp);
   }
   GNUNET_assert (pth->cth == NULL);
   pth->cth_in_progress++;
@@ -518,9 +523,9 @@
   ip = cp->inc_preference;
   cp->inc_preference = 0;
   cp->irc =
-      GNUNET_CORE_peer_change_preference (GSF_core, &target,
-                                          DBLOCK_SIZE, ip,
-                                          &core_reserve_callback, cp);
+      GNUNET_ATS_peer_change_preference (ats, &target,
+                                        DBLOCK_SIZE, ip,
+                                        &ats_reserve_callback, cp);
 }
 
 
@@ -535,7 +540,7 @@
  *        long should the client wait until re-trying?
  */
 static void
-core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
+ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
                        int32_t amount, struct GNUNET_TIME_Relative res_delay)
 {
   struct GSF_ConnectedPeer *cp = cls;
@@ -584,9 +589,9 @@
   cp->ppd.pid = GNUNET_PEER_intern (peer);
   cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO);
   cp->irc =
-      GNUNET_CORE_peer_change_preference (GSF_core, peer,
-                                          DBLOCK_SIZE, 0,
-                                          &core_reserve_callback, cp);
+      GNUNET_ATS_peer_change_preference (ats, peer,
+                                        DBLOCK_SIZE, 0,
+                                        &ats_reserve_callback, cp);
   fn = get_trust_filename (peer);
   if ((GNUNET_DISK_file_test (fn) == GNUNET_YES) &&
       (sizeof (trust) == GNUNET_DISK_fn_read (fn, &trust, sizeof (trust))))
@@ -1551,7 +1556,7 @@
   }
   if (NULL != cp->irc)
   {
-    GNUNET_CORE_peer_change_preference_cancel (cp->irc);
+    GNUNET_ATS_peer_change_preference_cancel (cp->irc);
     cp->irc = NULL;
   }
   if (GNUNET_SCHEDULER_NO_TASK != cp->irc_delay_task)
@@ -1825,6 +1830,7 @@
 GSF_connected_peer_init_ ()
 {
   cp_map = GNUNET_CONTAINER_multihashmap_create (128);
+  ats = GNUNET_ATS_init (GSF_cfg, NULL, NULL);
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONFIGURATION_get_value_filename (GSF_cfg, "fs",
                                                           "TRUST",
@@ -1863,6 +1869,8 @@
   cp_map = NULL;
   GNUNET_free (trustDirectory);
   trustDirectory = NULL;
+  GNUNET_ATS_shutdown (ats);
+  ats = NULL;
 }
 
 




reply via email to

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