aboutsummaryrefslogtreecommitdiff
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
parent900c1831440d1b6f9fdb35d39334bca2e94bdefb (diff)
downloadgnunet-013cf64f56c0a529f0c11597e912b39e4a0a896c.tar.gz
gnunet-013cf64f56c0a529f0c11597e912b39e4a0a896c.zip
first round of simplification to change preference API
-rw-r--r--src/core/Makefile.am3
-rw-r--r--src/core/core_api.c21
-rw-r--r--src/core/gnunet-service-core_sessions.c128
-rw-r--r--src/core/test_core_api_preferences.c10
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c9
-rw-r--r--src/fs/gnunet-service-fs_cp.c20
-rw-r--r--src/include/gnunet_core_service.h19
7 files changed, 71 insertions, 139 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 2ea90c9ff..65883d537 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -43,7 +43,8 @@ gnunet_service_core_new_SOURCES = \
43 gnunet-service-core_clients.c gnunet-service-core_clients.h \ 43 gnunet-service-core_clients.c gnunet-service-core_clients.h \
44 gnunet-service-core_neighbours.c gnunet-service-core_neighbours.h \ 44 gnunet-service-core_neighbours.c gnunet-service-core_neighbours.h \
45 gnunet-service-core_kx.c gnunet-service-core_kx.h \ 45 gnunet-service-core_kx.c gnunet-service-core_kx.h \
46 gnunet-service-core_sessions.c gnunet-service-core_sessions.h 46 gnunet-service-core_sessions.c gnunet-service-core_sessions.h \
47 gnunet-service-core_typemap.c gnunet-service-core_typemap.h
47gnunet_service_core_new_LDADD = \ 48gnunet_service_core_new_LDADD = \
48 $(top_builddir)/src/hello/libgnunethello.la \ 49 $(top_builddir)/src/hello/libgnunethello.la \
49 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ 50 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 24013b7cf..91368ffc3 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -421,7 +421,6 @@ static int
421disconnect_and_free_peer_entry (void *cls, const GNUNET_HashCode * key, 421disconnect_and_free_peer_entry (void *cls, const GNUNET_HashCode * key,
422 void *value) 422 void *value)
423{ 423{
424 static struct GNUNET_BANDWIDTH_Value32NBO zero;
425 struct GNUNET_CORE_Handle *h = cls; 424 struct GNUNET_CORE_Handle *h = cls;
426 struct GNUNET_CORE_TransmitHandle *th; 425 struct GNUNET_CORE_TransmitHandle *th;
427 struct PeerRecord *pr = value; 426 struct PeerRecord *pr = value;
@@ -449,7 +448,7 @@ disconnect_and_free_peer_entry (void *cls, const GNUNET_HashCode * key,
449 GNUNET_break (0); 448 GNUNET_break (0);
450 pcic_cls = pr->pcic_cls; 449 pcic_cls = pr->pcic_cls;
451 GNUNET_CORE_peer_change_preference_cancel (pr->pcic_ptr); 450 GNUNET_CORE_peer_change_preference_cancel (pr->pcic_ptr);
452 pcic (pcic_cls, &pr->peer, zero, 0, GNUNET_TIME_UNIT_FOREVER_REL, 0); 451 pcic (pcic_cls, &pr->peer, 0, GNUNET_TIME_UNIT_FOREVER_REL);
453 } 452 }
454 while (NULL != (th = pr->pending_head)) 453 while (NULL != (th = pr->pending_head))
455 { 454 {
@@ -1230,9 +1229,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
1230 GNUNET_free_non_null (pr->pcic_ptr); 1229 GNUNET_free_non_null (pr->pcic_ptr);
1231 pr->pcic_ptr = NULL; 1230 pr->pcic_ptr = NULL;
1232 if (pcic != NULL) 1231 if (pcic != NULL)
1233 pcic (pr->pcic_cls, &pr->peer, cim->bw_out, ntohl (cim->reserved_amount), 1232 pcic (pr->pcic_cls, &pr->peer, ntohl (cim->reserved_amount),
1234 GNUNET_TIME_relative_ntoh (cim->reserve_delay), 1233 GNUNET_TIME_relative_ntoh (cim->reserve_delay));
1235 GNUNET_ntohll (cim->preference));
1236 break; 1234 break;
1237 default: 1235 default:
1238 reconnect_later (h); 1236 reconnect_later (h);
@@ -1677,15 +1675,6 @@ change_preference_send_continuation (void *cls, int success)
1677 * 1675 *
1678 * @param h core handle 1676 * @param h core handle
1679 * @param peer identifies the peer 1677 * @param peer identifies the peer
1680 * @param timeout after how long should we give up (and call "info" with NULL
1681 * for "peer" to signal an error)?
1682 * @param bw_out set to the current bandwidth limit (sending) for this peer,
1683 * caller should set "bw_out" to "-1" to avoid changing
1684 * the current value; otherwise "bw_out" will be lowered to
1685 * the specified value; passing a pointer to "0" can be used to force
1686 * us to disconnect from the peer; "bw_out" might not increase
1687 * as specified since the upper bound is generally
1688 * determined by the other peer!
1689 * @param amount reserve N bytes for receiving, negative 1678 * @param amount reserve N bytes for receiving, negative
1690 * amounts can be used to undo a (recent) reservation; 1679 * amounts can be used to undo a (recent) reservation;
1691 * @param preference increase incoming traffic share preference by this amount; 1680 * @param preference increase incoming traffic share preference by this amount;
@@ -1699,8 +1688,6 @@ change_preference_send_continuation (void *cls, int success)
1699struct GNUNET_CORE_InformationRequestContext * 1688struct GNUNET_CORE_InformationRequestContext *
1700GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, 1689GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
1701 const struct GNUNET_PeerIdentity *peer, 1690 const struct GNUNET_PeerIdentity *peer,
1702 struct GNUNET_TIME_Relative timeout,
1703 struct GNUNET_BANDWIDTH_Value32NBO bw_out,
1704 int32_t amount, uint64_t preference, 1691 int32_t amount, uint64_t preference,
1705 GNUNET_CORE_PeerConfigurationInfoCallback 1692 GNUNET_CORE_PeerConfigurationInfoCallback
1706 info, void *info_cls) 1693 info, void *info_cls)
@@ -1735,7 +1722,7 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
1735 rim->header.size = htons (sizeof (struct RequestInfoMessage)); 1722 rim->header.size = htons (sizeof (struct RequestInfoMessage));
1736 rim->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO); 1723 rim->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO);
1737 rim->rim_id = htonl (pr->rim_id = h->rim_id_gen++); 1724 rim->rim_id = htonl (pr->rim_id = h->rim_id_gen++);
1738 rim->limit_outbound = bw_out; 1725 rim->limit_outbound = GNUNET_BANDWIDTH_VALUE_MAX; // FIXME: remove entirely soon...
1739 rim->reserve_inbound = htonl (amount); 1726 rim->reserve_inbound = htonl (amount);
1740 rim->preference_change = GNUNET_htonll (preference); 1727 rim->preference_change = GNUNET_htonll (preference);
1741 rim->peer = *peer; 1728 rim->peer = *peer;
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index b379c3ac7..6e1494373 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -710,102 +710,86 @@ void
710GSC_SESSIONS_handle_client_request_info (void *cls, struct GNUNET_SERVER_Client *client, 710GSC_SESSIONS_handle_client_request_info (void *cls, struct GNUNET_SERVER_Client *client,
711 const struct GNUNET_MessageHeader *message) 711 const struct GNUNET_MessageHeader *message)
712{ 712{
713#if 0
714 // FIXME!
715 const struct RequestInfoMessage *rcm; 713 const struct RequestInfoMessage *rcm;
716 struct GSC_Client *pos; 714 struct Session *session;
717 struct Neighbour *n;
718 struct ConfigurationInfoMessage cim; 715 struct ConfigurationInfoMessage cim;
719 int32_t want_reserv; 716 int32_t want_reserv;
720 int32_t got_reserv; 717 int32_t got_reserv;
721 unsigned long long old_preference;
722 struct GNUNET_TIME_Relative rdelay; 718 struct GNUNET_TIME_Relative rdelay;
723 719
724 rdelay = GNUNET_TIME_UNIT_ZERO; 720 rdelay = GNUNET_TIME_UNIT_ZERO;
725#if DEBUG_CORE_CLIENT 721#if DEBUG_CORE_CLIENT
726 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core service receives `%s' request.\n", 722 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
723 "Core service receives `%s' request.\n",
727 "REQUEST_INFO"); 724 "REQUEST_INFO");
728#endif 725#endif
729 rcm = (const struct RequestInfoMessage *) message; 726 rcm = (const struct RequestInfoMessage *) message;
730 n = find_neighbour (&rcm->peer); 727 session = find_session (&rcm->peer);
731 memset (&cim, 0, sizeof (cim)); 728 if (NULL == session)
732 if ((n != NULL) && (GNUNET_YES == n->is_connected))
733 {
734 want_reserv = ntohl (rcm->reserve_inbound);
735 if (n->bw_out_internal_limit.value__ != rcm->limit_outbound.value__)
736 {
737 n->bw_out_internal_limit = rcm->limit_outbound;
738 if (n->bw_out.value__ !=
739 GNUNET_BANDWIDTH_value_min (n->bw_out_internal_limit,
740 n->bw_out_external_limit).value__)
741 {
742 n->bw_out =
743 GNUNET_BANDWIDTH_value_min (n->bw_out_internal_limit,
744 n->bw_out_external_limit);
745 GNUNET_BANDWIDTH_tracker_update_quota (&n->available_recv_window,
746 n->bw_out);
747 GNUNET_TRANSPORT_set_quota (transport, &n->peer, n->bw_in, n->bw_out);
748 handle_peer_status_change (n);
749 }
750 }
751 if (want_reserv < 0)
752 {
753 got_reserv = want_reserv;
754 }
755 else if (want_reserv > 0)
756 {
757 rdelay =
758 GNUNET_BANDWIDTH_tracker_get_delay (&n->available_recv_window,
759 want_reserv);
760 if (rdelay.rel_value == 0)
761 got_reserv = want_reserv;
762 else
763 got_reserv = 0; /* all or nothing */
764 }
765 else
766 got_reserv = 0;
767 GNUNET_BANDWIDTH_tracker_consume (&n->available_recv_window, got_reserv);
768 old_preference = n->current_preference;
769 n->current_preference += GNUNET_ntohll (rcm->preference_change);
770 if (old_preference > n->current_preference)
771 {
772 /* overflow; cap at maximum value */
773 n->current_preference = ULLONG_MAX;
774 }
775 update_preference_sum (n->current_preference - old_preference);
776#if DEBUG_CORE_QUOTA
777 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
778 "Received reservation request for %d bytes for peer `%4s', reserved %d bytes, suggesting delay of %llu ms\n",
779 (int) want_reserv, GNUNET_i2s (&rcm->peer), (int) got_reserv,
780 (unsigned long long) rdelay.rel_value);
781#endif
782 cim.reserved_amount = htonl (got_reserv);
783 cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay);
784 cim.bw_out = n->bw_out;
785 cim.preference = n->current_preference;
786 }
787 else
788 { 729 {
789 /* Technically, this COULD happen (due to asynchronous behavior), 730 /* Technically, this COULD happen (due to asynchronous behavior),
790 * but it should be rare, so we should generate an info event 731 * but it should be rare, so we should generate an info event
791 * to help diagnosis of serious errors that might be masked by this */ 732 * to help diagnosis of serious errors that might be masked by this */
792 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 733 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
793 _ 734 _("Client asked for preference change with peer `%s', which is not connected!\n"),
794 ("Client asked for preference change with peer `%s', which is not connected!\n"),
795 GNUNET_i2s (&rcm->peer)); 735 GNUNET_i2s (&rcm->peer));
796 GNUNET_SERVER_receive_done (client, GNUNET_OK); 736 GNUNET_SERVER_receive_done (client, GNUNET_OK);
797 return; 737 return;
798 } 738 }
739
740 want_reserv = ntohl (rcm->reserve_inbound);
741 if (session->bw_out_internal_limit.value__ != rcm->limit_outbound.value__)
742 {
743 session->bw_out_internal_limit = rcm->limit_outbound;
744 if (session->bw_out.value__ !=
745 GNUNET_BANDWIDTH_value_min (session->bw_out_internal_limit,
746 session->bw_out_external_limit).value__)
747 {
748 session->bw_out =
749 GNUNET_BANDWIDTH_value_min (session->bw_out_internal_limit,
750 session->bw_out_external_limit);
751 GNUNET_BANDWIDTH_tracker_update_quota (&session->available_recv_window,
752 session->bw_out);
753#if 0
754 // FIXME: who does this?
755 GNUNET_TRANSPORT_set_quota (transport, &session->peer,
756 session->bw_in,
757 session->bw_out);
758#endif
759 }
760 }
761 if (want_reserv < 0)
762 {
763 got_reserv = want_reserv;
764 }
765 else if (want_reserv > 0)
766 {
767 rdelay =
768 GNUNET_BANDWIDTH_tracker_get_delay (&session->available_recv_window,
769 want_reserv);
770 if (rdelay.rel_value == 0)
771 got_reserv = want_reserv;
772 else
773 got_reserv = 0; /* all or nothing */
774 }
775 else
776 got_reserv = 0;
777 GNUNET_BANDWIDTH_tracker_consume (&session->available_recv_window, got_reserv);
778#if DEBUG_CORE_QUOTA
779 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
780 "Received reservation request for %d bytes for peer `%4s', reserved %d bytes, suggesting delay of %llu ms\n",
781 (int) want_reserv, GNUNET_i2s (&rcm->peer), (int) got_reserv,
782 (unsigned long long) rdelay.rel_value);
783#endif
799 cim.header.size = htons (sizeof (struct ConfigurationInfoMessage)); 784 cim.header.size = htons (sizeof (struct ConfigurationInfoMessage));
800 cim.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO); 785 cim.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO);
801 cim.peer = rcm->peer; 786 cim.reserved_amount = htonl (got_reserv);
787 cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay);
802 cim.rim_id = rcm->rim_id; 788 cim.rim_id = rcm->rim_id;
803#if DEBUG_CORE_CLIENT 789 cim.bw_out = session->bw_out;
804 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", 790 cim.preference = 0; /* FIXME: remove */
805 "CONFIGURATION_INFO"); 791 cim.peer = rcm->peer;
806#endif
807 GSC_CLIENTS_send_to_client (client, &cim.header, GNUNET_NO); 792 GSC_CLIENTS_send_to_client (client, &cim.header, GNUNET_NO);
808#endif
809 GNUNET_SERVER_receive_done (client, GNUNET_OK); 793 GNUNET_SERVER_receive_done (client, GNUNET_OK);
810} 794}
811 795
diff --git a/src/core/test_core_api_preferences.c b/src/core/test_core_api_preferences.c
index 19d51ef60..6d7f52953 100644
--- a/src/core/test_core_api_preferences.c
+++ b/src/core/test_core_api_preferences.c
@@ -154,8 +154,8 @@ transmit_ready (void *cls, size_t size, void *buf)
154 154
155static void 155static void
156preference_cb (void *cls, const struct GNUNET_PeerIdentity *peer, 156preference_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
157 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, int32_t amount, 157 int32_t amount,
158 struct GNUNET_TIME_Relative res_delay, uint64_t preference); 158 struct GNUNET_TIME_Relative res_delay);
159 159
160static void 160static void
161do_reserve (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 161do_reserve (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -173,16 +173,14 @@ do_reserve (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
173 "Requesting reservatin of 32k from core in 1s!\n"); 173 "Requesting reservatin of 32k from core in 1s!\n");
174 irc = 174 irc =
175 GNUNET_CORE_peer_change_preference (p1.ch, &p2.id, 175 GNUNET_CORE_peer_change_preference (p1.ch, &p2.id,
176 GNUNET_TIME_UNIT_SECONDS,
177 GNUNET_BANDWIDTH_VALUE_MAX,
178 1000000 /* bandwidth for 1s */ , 176 1000000 /* bandwidth for 1s */ ,
179 0, &preference_cb, pc); 177 0, &preference_cb, pc);
180} 178}
181 179
182static void 180static void
183preference_cb (void *cls, const struct GNUNET_PeerIdentity *peer, 181preference_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
184 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, int32_t amount, 182 int32_t amount,
185 struct GNUNET_TIME_Relative res_delay, uint64_t preference) 183 struct GNUNET_TIME_Relative res_delay)
186{ 184{
187 struct PeerContext *pc = cls; 185 struct PeerContext *pc = cls;
188 186
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 9d4885b78..0623c0cb1 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -452,20 +452,16 @@ update_core_preference (void *cls,
452 * 452 *
453 * @param cls closure 453 * @param cls closure
454 * @param peer identifies the peer 454 * @param peer identifies the peer
455 * @param bpm_out set to the current bandwidth limit (sending) for this peer
456 * @param amount set to the amount that was actually reserved or unreserved; 455 * @param amount set to the amount that was actually reserved or unreserved;
457 * either the full requested amount or zero (no partial reservations) 456 * either the full requested amount or zero (no partial reservations)
458 * @param res_delay if the reservation could not be satisfied (amount was 0), how 457 * @param res_delay if the reservation could not be satisfied (amount was 0), how
459 * long should the client wait until re-trying? 458 * long should the client wait until re-trying?
460 * @param preference current traffic preference for the given peer
461 */ 459 */
462static void 460static void
463update_core_preference_finish (void *cls, 461update_core_preference_finish (void *cls,
464 const struct GNUNET_PeerIdentity *peer, 462 const struct GNUNET_PeerIdentity *peer,
465 struct GNUNET_BANDWIDTH_Value32NBO bpm_out,
466 int32_t amount, 463 int32_t amount,
467 struct GNUNET_TIME_Relative res_delay, 464 struct GNUNET_TIME_Relative res_delay)
468 uint64_t preference)
469{ 465{
470 struct PeerInfo *peer_info = cls; 466 struct PeerInfo *peer_info = cls;
471 467
@@ -519,8 +515,7 @@ update_core_preference (void *cls,
519 GNUNET_NO); 515 GNUNET_NO);
520 peer->info_ctx = 516 peer->info_ctx =
521 GNUNET_CORE_peer_change_preference (coreAPI, &peer->id, 517 GNUNET_CORE_peer_change_preference (coreAPI, &peer->id,
522 GNUNET_TIME_UNIT_FOREVER_REL, 518 0,
523 GNUNET_BANDWIDTH_VALUE_MAX, 0,
524 preference, 519 preference,
525 &update_core_preference_finish, peer); 520 &update_core_preference_finish, peer);
526} 521}
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);
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index f33a78926..4eddda41f 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -244,25 +244,19 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle);
244 * 244 *
245 * @param cls closure 245 * @param cls closure
246 * @param peer identifies the peer 246 * @param peer identifies the peer
247 * @param bandwidth_out available amount of outbound bandwidth
248 * @param amount set to the amount that was actually reserved or unreserved; 247 * @param amount set to the amount that was actually reserved or unreserved;
249 * either the full requested amount or zero (no partial reservations) 248 * either the full requested amount or zero (no partial reservations)
250 * @param res_delay if the reservation could not be satisfied (amount was 0), how 249 * @param res_delay if the reservation could not be satisfied (amount was 0), how
251 * long should the client wait until re-trying? 250 * long should the client wait until re-trying?
252 * @param preference current traffic preference for the given peer
253 */ 251 */
254typedef void (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls, 252typedef void (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls,
255 const struct 253 const struct
256 GNUNET_PeerIdentity * 254 GNUNET_PeerIdentity *
257 peer, 255 peer,
258 struct
259 GNUNET_BANDWIDTH_Value32NBO
260 bandwidth_out,
261 int32_t amount, 256 int32_t amount,
262 struct 257 struct
263 GNUNET_TIME_Relative 258 GNUNET_TIME_Relative
264 res_delay, 259 res_delay);
265 uint64_t preference);
266 260
267 261
268 262
@@ -278,15 +272,6 @@ struct GNUNET_CORE_InformationRequestContext;
278 * 272 *
279 * @param h core handle 273 * @param h core handle
280 * @param peer identifies the peer 274 * @param peer identifies the peer
281 * @param timeout after how long should we give up (and call "info" with NULL
282 * for "peer" to signal an error)?
283 * @param bw_out set to the current bandwidth limit (sending) for this peer,
284 * caller should set "bpm_out" to "GNUNET_BANDWIDTH_VALUE_MAX" to avoid changing
285 * the current value; otherwise "bw_out" will be lowered to
286 * the specified value; passing a pointer to "0" can be used to force
287 * us to disconnect from the peer; "bw_out" might not increase
288 * as specified since the upper bound is generally
289 * determined by the other peer!
290 * @param amount reserve N bytes for receiving, negative 275 * @param amount reserve N bytes for receiving, negative
291 * amounts can be used to undo a (recent) reservation; 276 * amounts can be used to undo a (recent) reservation;
292 * @param preference increase incoming traffic share preference by this amount; 277 * @param preference increase incoming traffic share preference by this amount;
@@ -300,8 +285,6 @@ struct GNUNET_CORE_InformationRequestContext;
300struct GNUNET_CORE_InformationRequestContext * 285struct GNUNET_CORE_InformationRequestContext *
301GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, 286GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
302 const struct GNUNET_PeerIdentity *peer, 287 const struct GNUNET_PeerIdentity *peer,
303 struct GNUNET_TIME_Relative timeout,
304 struct GNUNET_BANDWIDTH_Value32NBO bw_out,
305 int32_t amount, uint64_t preference, 288 int32_t amount, uint64_t preference,
306 GNUNET_CORE_PeerConfigurationInfoCallback 289 GNUNET_CORE_PeerConfigurationInfoCallback
307 info, void *info_cls); 290 info, void *info_cls);