aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-10 11:06:33 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-10 11:06:33 +0000
commit9767d2478ccb8dcc3152cb617d84cd4cec2097c3 (patch)
tree584adb9bf94ba6d304f400ba350734bd5983898c /src/dht
parent107b3a706cf4d2f0276fb7534a846de5d36a73a9 (diff)
downloadgnunet-9767d2478ccb8dcc3152cb617d84cd4cec2097c3.tar.gz
gnunet-9767d2478ccb8dcc3152cb617d84cd4cec2097c3.zip
renaming in code to use new ATS pref/reservation API
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/Makefile.am1
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c23
2 files changed, 17 insertions, 7 deletions
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index a88611fb3..ba8b8457c 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -44,6 +44,7 @@ gnunet_service_dht_LDADD = \
44 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 44 $(top_builddir)/src/statistics/libgnunetstatistics.la \
45 $(top_builddir)/src/core/libgnunetcore.la \ 45 $(top_builddir)/src/core/libgnunetcore.la \
46 $(top_builddir)/src/nse/libgnunetnse.la \ 46 $(top_builddir)/src/nse/libgnunetnse.la \
47 $(top_builddir)/src/ats/libgnunetats.la \
47 $(top_builddir)/src/transport/libgnunettransport.la \ 48 $(top_builddir)/src/transport/libgnunettransport.la \
48 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ 49 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
49 $(top_builddir)/src/hello/libgnunethello.la \ 50 $(top_builddir)/src/hello/libgnunethello.la \
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 0623c0cb1..e1421e0f6 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -32,6 +32,7 @@
32#include "gnunet_constants.h" 32#include "gnunet_constants.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34#include "gnunet_nse_service.h" 34#include "gnunet_nse_service.h"
35#include "gnunet_ats_service.h"
35#include "gnunet_core_service.h" 36#include "gnunet_core_service.h"
36#include "gnunet_datacache_lib.h" 37#include "gnunet_datacache_lib.h"
37#include "gnunet_transport_service.h" 38#include "gnunet_transport_service.h"
@@ -321,7 +322,7 @@ struct PeerInfo
321 /** 322 /**
322 * Preference update context 323 * Preference update context
323 */ 324 */
324 struct GNUNET_CORE_InformationRequestContext *info_ctx; 325 struct GNUNET_ATS_InformationRequestContext *info_ctx;
325 326
326 /** 327 /**
327 * Task for scheduling preference updates 328 * Task for scheduling preference updates
@@ -407,10 +408,15 @@ static GNUNET_SCHEDULER_TaskIdentifier find_peer_task;
407static struct GNUNET_PeerIdentity my_identity; 408static struct GNUNET_PeerIdentity my_identity;
408 409
409/** 410/**
410 * Handle to GNUnet core. 411 * Handle to CORE.
411 */ 412 */
412static struct GNUNET_CORE_Handle *coreAPI; 413static struct GNUNET_CORE_Handle *coreAPI;
413 414
415/**
416 * Handle to ATS.
417 */
418static struct GNUNET_ATS_Handle *atsAPI;
419
414 420
415 421
416/** 422/**
@@ -514,10 +520,10 @@ update_core_preference (void *cls,
514 gettext_noop ("# Preference updates given to core"), 1, 520 gettext_noop ("# Preference updates given to core"), 1,
515 GNUNET_NO); 521 GNUNET_NO);
516 peer->info_ctx = 522 peer->info_ctx =
517 GNUNET_CORE_peer_change_preference (coreAPI, &peer->id, 523 GNUNET_ATS_peer_change_preference (atsAPI, &peer->id,
518 0, 524 0,
519 preference, 525 preference,
520 &update_core_preference_finish, peer); 526 &update_core_preference_finish, peer);
521} 527}
522 528
523 529
@@ -725,7 +731,7 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
725 to_remove)); 731 to_remove));
726 if (NULL != to_remove->info_ctx) 732 if (NULL != to_remove->info_ctx)
727 { 733 {
728 GNUNET_CORE_peer_change_preference_cancel (to_remove->info_ctx); 734 GNUNET_ATS_peer_change_preference_cancel (to_remove->info_ctx);
729 to_remove->info_ctx = NULL; 735 to_remove->info_ctx = NULL;
730 } 736 }
731 if (GNUNET_SCHEDULER_NO_TASK != to_remove->preference_task) 737 if (GNUNET_SCHEDULER_NO_TASK != to_remove->preference_task)
@@ -2040,6 +2046,7 @@ GDS_NEIGHBOURS_init ()
2040 GNUNET_CONFIGURATION_get_value_number (GDS_cfg, "DHT", "bucket_size", 2046 GNUNET_CONFIGURATION_get_value_number (GDS_cfg, "DHT", "bucket_size",
2041 &temp_config_num)) 2047 &temp_config_num))
2042 bucket_size = (unsigned int) temp_config_num; 2048 bucket_size = (unsigned int) temp_config_num;
2049 atsAPI = GNUNET_ATS_init (GDS_cfg, NULL, NULL);
2043 coreAPI = GNUNET_CORE_connect (GDS_cfg, 2050 coreAPI = GNUNET_CORE_connect (GDS_cfg,
2044 1, 2051 1,
2045 NULL, 2052 NULL,
@@ -2067,6 +2074,8 @@ GDS_NEIGHBOURS_done ()
2067 return; 2074 return;
2068 GNUNET_CORE_disconnect (coreAPI); 2075 GNUNET_CORE_disconnect (coreAPI);
2069 coreAPI = NULL; 2076 coreAPI = NULL;
2077 GNUNET_ATS_shutdown (atsAPI);
2078 atsAPI = NULL;
2070 GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (all_known_peers)); 2079 GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (all_known_peers));
2071 GNUNET_CONTAINER_multihashmap_destroy (all_known_peers); 2080 GNUNET_CONTAINER_multihashmap_destroy (all_known_peers);
2072 all_known_peers = NULL; 2081 all_known_peers = NULL;