diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-12-13 12:41:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-12-13 12:41:37 +0000 |
commit | 734dfed95670f282509a3805906dee09af973fab (patch) | |
tree | 1ae60e27406b07bd0c496bdd5d8603a902399a34 /src | |
parent | 715e830472d7da776bdf9ef6f0f57dbf17d8e8be (diff) | |
download | gnunet-734dfed95670f282509a3805906dee09af973fab.tar.gz gnunet-734dfed95670f282509a3805906dee09af973fab.zip |
changes
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/test_ats_api_scheduling_switch_network.c | 79 |
1 files changed, 63 insertions, 16 deletions
diff --git a/src/ats/test_ats_api_scheduling_switch_network.c b/src/ats/test_ats_api_scheduling_switch_network.c index 937687806..fb2ea70e7 100644 --- a/src/ats/test_ats_api_scheduling_switch_network.c +++ b/src/ats/test_ats_api_scheduling_switch_network.c | |||
@@ -19,8 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file ats/test_ats_api_scheduling_update_address.c | 21 | * @file ats/test_ats_api_scheduling_update_address.c |
22 | * @brief test updating an address: add address, get and compare it, update it | 22 | * @brief test updating networtk type of an address |
23 | * get it again and compre | ||
24 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
25 | * @author Matthias Wachs | 24 | * @author Matthias Wachs |
26 | */ | 25 | */ |
@@ -115,6 +114,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
115 | uint32_t ats_count) | 114 | uint32_t ats_count) |
116 | { | 115 | { |
117 | static int stage = 0; | 116 | static int stage = 0; |
117 | int level; | ||
118 | char *text; | ||
118 | if (0 == stage) | 119 | if (0 == stage) |
119 | { | 120 | { |
120 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 121 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
@@ -143,19 +144,47 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
143 | 144 | ||
144 | if (ntohl(bandwidth_out.value__) == quota_out[GNUNET_ATS_NET_WAN]) | 145 | if (ntohl(bandwidth_out.value__) == quota_out[GNUNET_ATS_NET_WAN]) |
145 | { | 146 | { |
146 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: WAN quota out correct \n", stage); | 147 | level = GNUNET_ERROR_TYPE_DEBUG; |
148 | text = "correct"; | ||
149 | ret = 0; | ||
147 | } | 150 | } |
148 | else | 151 | else |
149 | { | 152 | { |
150 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: WAN quota out wrong \n", stage); | 153 | level = GNUNET_ERROR_TYPE_ERROR; |
154 | text = "wrong"; | ||
155 | ret = 1; | ||
151 | } | 156 | } |
157 | |||
158 | GNUNET_log (level, "Stage %u: WAN outbound quota out %s: Received %llu, configured %llu\n", | ||
159 | stage, | ||
160 | text, | ||
161 | (unsigned long long int) ntohl(bandwidth_out.value__), | ||
162 | quota_out[GNUNET_ATS_NET_WAN]); | ||
163 | |||
152 | if (ntohl(bandwidth_in.value__) == quota_in[GNUNET_ATS_NET_WAN]) | 164 | if (ntohl(bandwidth_in.value__) == quota_in[GNUNET_ATS_NET_WAN]) |
153 | { | 165 | { |
154 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: WAN quota in correct \n", stage); | 166 | level = GNUNET_ERROR_TYPE_DEBUG; |
167 | text = "correct"; | ||
168 | ret = 0; | ||
155 | } | 169 | } |
156 | else | 170 | else |
157 | { | 171 | { |
158 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: WAN quota in wrong \n", stage); | 172 | level = GNUNET_ERROR_TYPE_ERROR; |
173 | text = "wrong"; | ||
174 | ret = 1; | ||
175 | } | ||
176 | |||
177 | |||
178 | GNUNET_log (level, "Stage %u: WAN inbound quota out %s: Received %llu, configured %llu\n", | ||
179 | stage, | ||
180 | text, | ||
181 | (unsigned long long int) ntohl(bandwidth_out.value__), | ||
182 | quota_out[GNUNET_ATS_NET_WAN]); | ||
183 | |||
184 | if (1 == ret) | ||
185 | { | ||
186 | GNUNET_SCHEDULER_add_now (&end, NULL); | ||
187 | return; | ||
159 | } | 188 | } |
160 | 189 | ||
161 | /* Update address */ | 190 | /* Update address */ |
@@ -200,23 +229,41 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
200 | 229 | ||
201 | if (ntohl(bandwidth_out.value__) == quota_out[GNUNET_ATS_NET_LAN]) | 230 | if (ntohl(bandwidth_out.value__) == quota_out[GNUNET_ATS_NET_LAN]) |
202 | { | 231 | { |
203 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: LAN quota out correct \n", stage); | 232 | level = GNUNET_ERROR_TYPE_DEBUG; |
233 | text = "correct"; | ||
204 | ret = 0; | 234 | ret = 0; |
205 | } | 235 | } |
206 | else | 236 | else |
207 | { | 237 | { |
208 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: LAN quota out wrong \n", stage); | 238 | level = GNUNET_ERROR_TYPE_ERROR; |
239 | text = "wrong"; | ||
209 | ret = 1; | 240 | ret = 1; |
210 | } | 241 | } |
242 | |||
243 | GNUNET_log (level, "Stage %u: LAN outbound quota out %s: Received %llu, configured %llu\n", | ||
244 | stage, | ||
245 | text, | ||
246 | (unsigned long long int) ntohl(bandwidth_out.value__), | ||
247 | quota_out[GNUNET_ATS_NET_LAN]); | ||
248 | |||
211 | if (ntohl(bandwidth_in.value__) == quota_in[GNUNET_ATS_NET_LAN]) | 249 | if (ntohl(bandwidth_in.value__) == quota_in[GNUNET_ATS_NET_LAN]) |
212 | { | 250 | { |
213 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: LAN quota in correct \n", stage); | 251 | level = GNUNET_ERROR_TYPE_DEBUG; |
214 | } | 252 | text = "correct"; |
215 | else | 253 | ret = 0; |
216 | { | 254 | } |
217 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: LAN quota in wrong \n", stage); | 255 | else |
218 | ret = 1; | 256 | { |
219 | } | 257 | level = GNUNET_ERROR_TYPE_ERROR; |
258 | text = "wrong"; | ||
259 | ret = 1; | ||
260 | } | ||
261 | |||
262 | GNUNET_log (level, "Stage %u: LAN inbound quota out %s: Received %llu, configured %llu\n", | ||
263 | stage, | ||
264 | text, | ||
265 | (unsigned long long int) ntohl(bandwidth_out.value__), | ||
266 | quota_out[GNUNET_ATS_NET_LAN]); | ||
220 | 267 | ||
221 | GNUNET_SCHEDULER_add_now (&end, NULL); | 268 | GNUNET_SCHEDULER_add_now (&end, NULL); |
222 | } | 269 | } |