diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-10 11:06:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-10 11:06:33 +0000 |
commit | 9767d2478ccb8dcc3152cb617d84cd4cec2097c3 (patch) | |
tree | 584adb9bf94ba6d304f400ba350734bd5983898c /src/fs | |
parent | 107b3a706cf4d2f0276fb7534a846de5d36a73a9 (diff) | |
download | gnunet-9767d2478ccb8dcc3152cb617d84cd4cec2097c3.tar.gz gnunet-9767d2478ccb8dcc3152cb617d84cd4cec2097c3.zip |
renaming in code to use new ATS pref/reservation API
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/Makefile.am | 1 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 36 |
2 files changed, 23 insertions, 14 deletions
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index ae8d699a1..85e3a4539 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am | |||
@@ -119,6 +119,7 @@ gnunet_service_fs_LDADD = \ | |||
119 | $(top_builddir)/src/block/libgnunetblock.la \ | 119 | $(top_builddir)/src/block/libgnunetblock.la \ |
120 | $(top_builddir)/src/datastore/libgnunetdatastore.la \ | 120 | $(top_builddir)/src/datastore/libgnunetdatastore.la \ |
121 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 121 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
122 | $(top_builddir)/src/ats/libgnunetats.la \ | ||
122 | $(top_builddir)/src/core/libgnunetcore.la \ | 123 | $(top_builddir)/src/core/libgnunetcore.la \ |
123 | $(top_builddir)/src/util/libgnunetutil.la \ | 124 | $(top_builddir)/src/util/libgnunetutil.la \ |
124 | $(GN_LIBINTL) | 125 | $(GN_LIBINTL) |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index ed855c42e..05e5bedef 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_load_lib.h" | 27 | #include "gnunet_load_lib.h" |
28 | #include "gnunet_ats_service.h" | ||
28 | #include "gnunet-service-fs.h" | 29 | #include "gnunet-service-fs.h" |
29 | #include "gnunet-service-fs_cp.h" | 30 | #include "gnunet-service-fs_cp.h" |
30 | #include "gnunet-service-fs_pe.h" | 31 | #include "gnunet-service-fs_pe.h" |
@@ -240,9 +241,9 @@ struct GSF_ConnectedPeer | |||
240 | struct GSF_PeerTransmitHandle *migration_pth; | 241 | struct GSF_PeerTransmitHandle *migration_pth; |
241 | 242 | ||
242 | /** | 243 | /** |
243 | * Context of our GNUNET_CORE_peer_change_preference call (or NULL). | 244 | * Context of our GNUNET_ATS_peer_change_preference call (or NULL). |
244 | */ | 245 | */ |
245 | struct GNUNET_CORE_InformationRequestContext *irc; | 246 | struct GNUNET_ATS_InformationRequestContext *irc; |
246 | 247 | ||
247 | /** | 248 | /** |
248 | * Task scheduled if we need to retry bandwidth reservation later. | 249 | * Task scheduled if we need to retry bandwidth reservation later. |
@@ -301,6 +302,10 @@ static struct GNUNET_CONTAINER_MultiHashMap *cp_map; | |||
301 | */ | 302 | */ |
302 | static char *trustDirectory; | 303 | static char *trustDirectory; |
303 | 304 | ||
305 | /** | ||
306 | * Handle to ATS service. | ||
307 | */ | ||
308 | static struct GNUNET_ATS_Handle *ats; | ||
304 | 309 | ||
305 | /** | 310 | /** |
306 | * Get the filename under which we would store the GNUNET_HELLO_Message | 311 | * Get the filename under which we would store the GNUNET_HELLO_Message |
@@ -399,7 +404,7 @@ peer_transmit_ready_cb (void *cls, size_t size, void *buf); | |||
399 | * long should the client wait until re-trying? | 404 | * long should the client wait until re-trying? |
400 | */ | 405 | */ |
401 | static void | 406 | static void |
402 | core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | 407 | ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, |
403 | int32_t amount, struct GNUNET_TIME_Relative res_delay); | 408 | int32_t amount, struct GNUNET_TIME_Relative res_delay); |
404 | 409 | ||
405 | 410 | ||
@@ -432,9 +437,9 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth) | |||
432 | ip = cp->inc_preference; | 437 | ip = cp->inc_preference; |
433 | cp->inc_preference = 0; | 438 | cp->inc_preference = 0; |
434 | cp->irc = | 439 | cp->irc = |
435 | GNUNET_CORE_peer_change_preference (GSF_core, &target, | 440 | GNUNET_ATS_peer_change_preference (ats, &target, |
436 | DBLOCK_SIZE, ip, | 441 | DBLOCK_SIZE, ip, |
437 | &core_reserve_callback, cp); | 442 | &ats_reserve_callback, cp); |
438 | } | 443 | } |
439 | GNUNET_assert (pth->cth == NULL); | 444 | GNUNET_assert (pth->cth == NULL); |
440 | pth->cth_in_progress++; | 445 | pth->cth_in_progress++; |
@@ -518,9 +523,9 @@ retry_reservation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
518 | ip = cp->inc_preference; | 523 | ip = cp->inc_preference; |
519 | cp->inc_preference = 0; | 524 | cp->inc_preference = 0; |
520 | cp->irc = | 525 | cp->irc = |
521 | GNUNET_CORE_peer_change_preference (GSF_core, &target, | 526 | GNUNET_ATS_peer_change_preference (ats, &target, |
522 | DBLOCK_SIZE, ip, | 527 | DBLOCK_SIZE, ip, |
523 | &core_reserve_callback, cp); | 528 | &ats_reserve_callback, cp); |
524 | } | 529 | } |
525 | 530 | ||
526 | 531 | ||
@@ -535,7 +540,7 @@ retry_reservation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
535 | * long should the client wait until re-trying? | 540 | * long should the client wait until re-trying? |
536 | */ | 541 | */ |
537 | static void | 542 | static void |
538 | core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | 543 | ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, |
539 | int32_t amount, struct GNUNET_TIME_Relative res_delay) | 544 | int32_t amount, struct GNUNET_TIME_Relative res_delay) |
540 | { | 545 | { |
541 | struct GSF_ConnectedPeer *cp = cls; | 546 | struct GSF_ConnectedPeer *cp = cls; |
@@ -584,9 +589,9 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, | |||
584 | cp->ppd.pid = GNUNET_PEER_intern (peer); | 589 | cp->ppd.pid = GNUNET_PEER_intern (peer); |
585 | cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); | 590 | cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); |
586 | cp->irc = | 591 | cp->irc = |
587 | GNUNET_CORE_peer_change_preference (GSF_core, peer, | 592 | GNUNET_ATS_peer_change_preference (ats, peer, |
588 | DBLOCK_SIZE, 0, | 593 | DBLOCK_SIZE, 0, |
589 | &core_reserve_callback, cp); | 594 | &ats_reserve_callback, cp); |
590 | fn = get_trust_filename (peer); | 595 | fn = get_trust_filename (peer); |
591 | if ((GNUNET_DISK_file_test (fn) == GNUNET_YES) && | 596 | if ((GNUNET_DISK_file_test (fn) == GNUNET_YES) && |
592 | (sizeof (trust) == GNUNET_DISK_fn_read (fn, &trust, sizeof (trust)))) | 597 | (sizeof (trust) == GNUNET_DISK_fn_read (fn, &trust, sizeof (trust)))) |
@@ -1551,7 +1556,7 @@ GSF_peer_disconnect_handler_ (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1551 | } | 1556 | } |
1552 | if (NULL != cp->irc) | 1557 | if (NULL != cp->irc) |
1553 | { | 1558 | { |
1554 | GNUNET_CORE_peer_change_preference_cancel (cp->irc); | 1559 | GNUNET_ATS_peer_change_preference_cancel (cp->irc); |
1555 | cp->irc = NULL; | 1560 | cp->irc = NULL; |
1556 | } | 1561 | } |
1557 | if (GNUNET_SCHEDULER_NO_TASK != cp->irc_delay_task) | 1562 | if (GNUNET_SCHEDULER_NO_TASK != cp->irc_delay_task) |
@@ -1825,6 +1830,7 @@ void | |||
1825 | GSF_connected_peer_init_ () | 1830 | GSF_connected_peer_init_ () |
1826 | { | 1831 | { |
1827 | cp_map = GNUNET_CONTAINER_multihashmap_create (128); | 1832 | cp_map = GNUNET_CONTAINER_multihashmap_create (128); |
1833 | ats = GNUNET_ATS_init (GSF_cfg, NULL, NULL); | ||
1828 | GNUNET_assert (GNUNET_OK == | 1834 | GNUNET_assert (GNUNET_OK == |
1829 | GNUNET_CONFIGURATION_get_value_filename (GSF_cfg, "fs", | 1835 | GNUNET_CONFIGURATION_get_value_filename (GSF_cfg, "fs", |
1830 | "TRUST", | 1836 | "TRUST", |
@@ -1863,6 +1869,8 @@ GSF_connected_peer_done_ () | |||
1863 | cp_map = NULL; | 1869 | cp_map = NULL; |
1864 | GNUNET_free (trustDirectory); | 1870 | GNUNET_free (trustDirectory); |
1865 | trustDirectory = NULL; | 1871 | trustDirectory = NULL; |
1872 | GNUNET_ATS_shutdown (ats); | ||
1873 | ats = NULL; | ||
1866 | } | 1874 | } |
1867 | 1875 | ||
1868 | 1876 | ||