diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-07 15:26:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-07 15:26:06 +0000 |
commit | 013cf64f56c0a529f0c11597e912b39e4a0a896c (patch) | |
tree | 763624e31708ea0d0b7b8f11f5c1308e220c0b94 /src/core/core_api.c | |
parent | 900c1831440d1b6f9fdb35d39334bca2e94bdefb (diff) | |
download | gnunet-013cf64f56c0a529f0c11597e912b39e4a0a896c.tar.gz gnunet-013cf64f56c0a529f0c11597e912b39e4a0a896c.zip |
first round of simplification to change preference API
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r-- | src/core/core_api.c | 21 |
1 files changed, 4 insertions, 17 deletions
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 | |||
421 | disconnect_and_free_peer_entry (void *cls, const GNUNET_HashCode * key, | 421 | disconnect_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) | |||
1699 | struct GNUNET_CORE_InformationRequestContext * | 1688 | struct GNUNET_CORE_InformationRequestContext * |
1700 | GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | 1689 | GNUNET_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; |