aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_cp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-07 15:26:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-07 15:26:06 +0000
commit013cf64f56c0a529f0c11597e912b39e4a0a896c (patch)
tree763624e31708ea0d0b7b8f11f5c1308e220c0b94 /src/fs/gnunet-service-fs_cp.c
parent900c1831440d1b6f9fdb35d39334bca2e94bdefb (diff)
downloadgnunet-013cf64f56c0a529f0c11597e912b39e4a0a896c.tar.gz
gnunet-013cf64f56c0a529f0c11597e912b39e4a0a896c.zip
first round of simplification to change preference API
Diffstat (limited to 'src/fs/gnunet-service-fs_cp.c')
-rw-r--r--src/fs/gnunet-service-fs_cp.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 49b01724f..ed855c42e 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -388,25 +388,19 @@ static size_t
388peer_transmit_ready_cb (void *cls, size_t size, void *buf); 388peer_transmit_ready_cb (void *cls, size_t size, void *buf);
389 389
390 390
391
392
393/** 391/**
394 * Function called by core upon success or failure of our bandwidth reservation request. 392 * Function called by core upon success or failure of our bandwidth reservation request.
395 * 393 *
396 * @param cls the 'struct GSF_ConnectedPeer' of the peer for which we made the request 394 * @param cls the 'struct GSF_ConnectedPeer' of the peer for which we made the request
397 * @param peer identifies the peer 395 * @param peer identifies the peer
398 * @param bandwidth_out available amount of outbound bandwidth
399 * @param amount set to the amount that was actually reserved or unreserved; 396 * @param amount set to the amount that was actually reserved or unreserved;
400 * either the full requested amount or zero (no partial reservations) 397 * either the full requested amount or zero (no partial reservations)
401 * @param res_delay if the reservation could not be satisfied (amount was 0), how 398 * @param res_delay if the reservation could not be satisfied (amount was 0), how
402 * long should the client wait until re-trying? 399 * long should the client wait until re-trying?
403 * @param preference current traffic preference for the given peer
404 */ 400 */
405static void 401static void
406core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, 402core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
407 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 403 int32_t amount, struct GNUNET_TIME_Relative res_delay);
408 int32_t amount, struct GNUNET_TIME_Relative res_delay,
409 uint64_t preference);
410 404
411 405
412/** 406/**
@@ -439,8 +433,6 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
439 cp->inc_preference = 0; 433 cp->inc_preference = 0;
440 cp->irc = 434 cp->irc =
441 GNUNET_CORE_peer_change_preference (GSF_core, &target, 435 GNUNET_CORE_peer_change_preference (GSF_core, &target,
442 GNUNET_TIME_UNIT_FOREVER_REL,
443 GNUNET_BANDWIDTH_VALUE_MAX,
444 DBLOCK_SIZE, ip, 436 DBLOCK_SIZE, ip,
445 &core_reserve_callback, cp); 437 &core_reserve_callback, cp);
446 } 438 }
@@ -527,8 +519,6 @@ retry_reservation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
527 cp->inc_preference = 0; 519 cp->inc_preference = 0;
528 cp->irc = 520 cp->irc =
529 GNUNET_CORE_peer_change_preference (GSF_core, &target, 521 GNUNET_CORE_peer_change_preference (GSF_core, &target,
530 GNUNET_TIME_UNIT_FOREVER_REL,
531 GNUNET_BANDWIDTH_VALUE_MAX,
532 DBLOCK_SIZE, ip, 522 DBLOCK_SIZE, ip,
533 &core_reserve_callback, cp); 523 &core_reserve_callback, cp);
534} 524}
@@ -539,18 +529,14 @@ retry_reservation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
539 * 529 *
540 * @param cls the 'struct GSF_ConnectedPeer' of the peer for which we made the request 530 * @param cls the 'struct GSF_ConnectedPeer' of the peer for which we made the request
541 * @param peer identifies the peer 531 * @param peer identifies the peer
542 * @param bandwidth_out available amount of outbound bandwidth
543 * @param amount set to the amount that was actually reserved or unreserved; 532 * @param amount set to the amount that was actually reserved or unreserved;
544 * either the full requested amount or zero (no partial reservations) 533 * either the full requested amount or zero (no partial reservations)
545 * @param res_delay if the reservation could not be satisfied (amount was 0), how 534 * @param res_delay if the reservation could not be satisfied (amount was 0), how
546 * long should the client wait until re-trying? 535 * long should the client wait until re-trying?
547 * @param preference current traffic preference for the given peer
548 */ 536 */
549static void 537static void
550core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, 538core_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
551 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 539 int32_t amount, struct GNUNET_TIME_Relative res_delay)
552 int32_t amount, struct GNUNET_TIME_Relative res_delay,
553 uint64_t preference)
554{ 540{
555 struct GSF_ConnectedPeer *cp = cls; 541 struct GSF_ConnectedPeer *cp = cls;
556 struct GSF_PeerTransmitHandle *pth; 542 struct GSF_PeerTransmitHandle *pth;
@@ -599,8 +585,6 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer,
599 cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); 585 cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO);
600 cp->irc = 586 cp->irc =
601 GNUNET_CORE_peer_change_preference (GSF_core, peer, 587 GNUNET_CORE_peer_change_preference (GSF_core, peer,
602 GNUNET_TIME_UNIT_FOREVER_REL,
603 GNUNET_BANDWIDTH_VALUE_MAX,
604 DBLOCK_SIZE, 0, 588 DBLOCK_SIZE, 0,
605 &core_reserve_callback, cp); 589 &core_reserve_callback, cp);
606 fn = get_trust_filename (peer); 590 fn = get_trust_filename (peer);