diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-11 18:29:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-11 18:29:54 +0000 |
commit | 7a257361b5e118f33adb182dd1996fccd52ecda8 (patch) | |
tree | 4f0716f4516ce8f005b8b4e17d206f1dd8f95508 | |
parent | 81defaa37bf4211f443f74384944642030807018 (diff) | |
download | gnunet-7a257361b5e118f33adb182dd1996fccd52ecda8.tar.gz gnunet-7a257361b5e118f33adb182dd1996fccd52ecda8.zip |
-remove unused exported symbol
-rw-r--r-- | src/ats/gnunet-service-ats_reservations.c | 30 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_reservations.h | 16 |
2 files changed, 21 insertions, 25 deletions
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c index 2bcbe9ac9..d1f80b762 100644 --- a/src/ats/gnunet-service-ats_reservations.c +++ b/src/ats/gnunet-service-ats_reservations.c | |||
@@ -51,16 +51,22 @@ static struct GNUNET_CONTAINER_MultiPeerMap *trackers; | |||
51 | * peer is not connected, otherwise the time to wait | 51 | * peer is not connected, otherwise the time to wait |
52 | * until the reservation might succeed | 52 | * until the reservation might succeed |
53 | */ | 53 | */ |
54 | struct GNUNET_TIME_Relative | 54 | static struct GNUNET_TIME_Relative |
55 | GAS_reservations_reserve (const struct GNUNET_PeerIdentity *peer, | 55 | reservations_reserve (const struct GNUNET_PeerIdentity *peer, |
56 | int32_t amount) | 56 | int32_t amount) |
57 | { | 57 | { |
58 | struct GNUNET_BANDWIDTH_Tracker *tracker; | 58 | struct GNUNET_BANDWIDTH_Tracker *tracker; |
59 | struct GNUNET_TIME_Relative ret; | 59 | struct GNUNET_TIME_Relative ret; |
60 | 60 | ||
61 | tracker = GNUNET_CONTAINER_multipeermap_get (trackers, peer); | 61 | tracker = GNUNET_CONTAINER_multipeermap_get (trackers, |
62 | peer); | ||
62 | if (NULL == tracker) | 63 | if (NULL == tracker) |
64 | { | ||
65 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
66 | "Not connected, allowing reservation of %d bytes\n", | ||
67 | (int) amount); | ||
63 | return GNUNET_TIME_UNIT_ZERO; /* not connected, satisfy now */ | 68 | return GNUNET_TIME_UNIT_ZERO; /* not connected, satisfy now */ |
69 | } | ||
64 | if (amount >= 0) | 70 | if (amount >= 0) |
65 | { | 71 | { |
66 | ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount); | 72 | ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount); |
@@ -75,7 +81,9 @@ GAS_reservations_reserve (const struct GNUNET_PeerIdentity *peer, | |||
75 | } | 81 | } |
76 | } | 82 | } |
77 | (void) GNUNET_BANDWIDTH_tracker_consume (tracker, amount); | 83 | (void) GNUNET_BANDWIDTH_tracker_consume (tracker, amount); |
78 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reserved %d bytes\n", (int) amount); | 84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
85 | "Reserved %d bytes\n", | ||
86 | (int) amount); | ||
79 | return GNUNET_TIME_UNIT_ZERO; | 87 | return GNUNET_TIME_UNIT_ZERO; |
80 | } | 88 | } |
81 | 89 | ||
@@ -112,11 +120,14 @@ GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer, | |||
112 | GNUNET_BANDWIDTH_tracker_init (tracker, NULL, NULL, bandwidth_in, | 120 | GNUNET_BANDWIDTH_tracker_init (tracker, NULL, NULL, bandwidth_in, |
113 | MAX_BANDWIDTH_CARRY_S); | 121 | MAX_BANDWIDTH_CARRY_S); |
114 | GNUNET_assert (GNUNET_OK == | 122 | GNUNET_assert (GNUNET_OK == |
115 | GNUNET_CONTAINER_multipeermap_put (trackers, peer, tracker, | 123 | GNUNET_CONTAINER_multipeermap_put (trackers, |
124 | peer, | ||
125 | tracker, | ||
116 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 126 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
117 | return; | 127 | return; |
118 | } | 128 | } |
119 | GNUNET_BANDWIDTH_tracker_update_quota (tracker, bandwidth_in); | 129 | GNUNET_BANDWIDTH_tracker_update_quota (tracker, |
130 | bandwidth_in); | ||
120 | } | 131 | } |
121 | 132 | ||
122 | 133 | ||
@@ -149,7 +160,7 @@ GAS_handle_reservation_request (void *cls, | |||
149 | return; | 160 | return; |
150 | } | 161 | } |
151 | amount = (int32_t) ntohl (msg->amount); | 162 | amount = (int32_t) ntohl (msg->amount); |
152 | res_delay = GAS_reservations_reserve (&msg->peer, amount); | 163 | res_delay = reservations_reserve (&msg->peer, amount); |
153 | if (res_delay.rel_value_us > 0) | 164 | if (res_delay.rel_value_us > 0) |
154 | amount = 0; | 165 | amount = 0; |
155 | result.header.size = htons (sizeof (struct ReservationResultMessage)); | 166 | result.header.size = htons (sizeof (struct ReservationResultMessage)); |
@@ -179,7 +190,8 @@ GAS_handle_reservation_request (void *cls, | |||
179 | void | 190 | void |
180 | GAS_reservations_init (struct GNUNET_SERVER_Handle *server) | 191 | GAS_reservations_init (struct GNUNET_SERVER_Handle *server) |
181 | { | 192 | { |
182 | trackers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 193 | trackers = GNUNET_CONTAINER_multipeermap_create (128, |
194 | GNUNET_NO); | ||
183 | } | 195 | } |
184 | 196 | ||
185 | 197 | ||
diff --git a/src/ats/gnunet-service-ats_reservations.h b/src/ats/gnunet-service-ats_reservations.h index 30eb6028b..6ee01565c 100644 --- a/src/ats/gnunet-service-ats_reservations.h +++ b/src/ats/gnunet-service-ats_reservations.h | |||
@@ -44,22 +44,6 @@ GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer, | |||
44 | 44 | ||
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Reserve the given amount of incoming bandwidth (in bytes) from the | ||
48 | * given peer. If a reservation is not possible right now, return how | ||
49 | * long the client should wait before trying again. | ||
50 | * | ||
51 | * @param peer peer to reserve bandwidth from | ||
52 | * @param amount number of bytes to reserve | ||
53 | * @return 0 if the reservation was successful, FOREVER if the | ||
54 | * peer is not connected, otherwise the time to wait | ||
55 | * until the reservation might succeed | ||
56 | */ | ||
57 | struct GNUNET_TIME_Relative | ||
58 | GAS_reservations_reserve (const struct GNUNET_PeerIdentity *peer, | ||
59 | int32_t amount); | ||
60 | |||
61 | |||
62 | /** | ||
63 | * Handle 'reservation request' messages from clients. | 47 | * Handle 'reservation request' messages from clients. |
64 | * | 48 | * |
65 | * @param cls unused, NULL | 49 | * @param cls unused, NULL |