diff options
Diffstat (limited to 'src/core/test_core_quota_compliance.c')
-rw-r--r-- | src/core/test_core_quota_compliance.c | 878 |
1 files changed, 442 insertions, 436 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 9db9ab750..8d18835ac 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -46,16 +46,18 @@ | |||
46 | /** | 46 | /** |
47 | * How long until we give up on transmitting the message? | 47 | * How long until we give up on transmitting the message? |
48 | */ | 48 | */ |
49 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 300) | 49 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * What delay do we request from the core service for transmission? | 52 | * What delay do we request from the core service for transmission? |
53 | */ | 53 | */ |
54 | #define FAST_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 150) | 54 | #define FAST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ |
55 | 150) | ||
55 | 56 | ||
56 | #define MTYPE 12345 | 57 | #define MTYPE 12345 |
57 | #define MESSAGESIZE (1024 - 8) | 58 | #define MESSAGESIZE (1024 - 8) |
58 | #define MEASUREMENT_LENGTH GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30) | 59 | #define MEASUREMENT_LENGTH GNUNET_TIME_relative_multiply ( \ |
60 | GNUNET_TIME_UNIT_SECONDS, 30) | ||
59 | 61 | ||
60 | static unsigned long long total_bytes_sent; | 62 | static unsigned long long total_bytes_sent; |
61 | static unsigned long long total_bytes_recv; | 63 | static unsigned long long total_bytes_recv; |
@@ -67,7 +69,8 @@ static struct GNUNET_SCHEDULER_Task *err_task; | |||
67 | static struct GNUNET_SCHEDULER_Task *measure_task; | 69 | static struct GNUNET_SCHEDULER_Task *measure_task; |
68 | 70 | ||
69 | 71 | ||
70 | struct PeerContext { | 72 | struct PeerContext |
73 | { | ||
71 | struct GNUNET_CONFIGURATION_Handle *cfg; | 74 | struct GNUNET_CONFIGURATION_Handle *cfg; |
72 | struct GNUNET_CORE_Handle *ch; | 75 | struct GNUNET_CORE_Handle *ch; |
73 | struct GNUNET_MQ_Handle *mq; | 76 | struct GNUNET_MQ_Handle *mq; |
@@ -98,12 +101,15 @@ static int running; | |||
98 | 101 | ||
99 | 102 | ||
100 | #if VERBOSE | 103 | #if VERBOSE |
101 | #define OKPP do { ok++; GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) | 104 | #define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, \ |
105 | "Now at stage %u at %s:%u\n", ok, __FILE__, \ | ||
106 | __LINE__); } while (0) | ||
102 | #else | 107 | #else |
103 | #define OKPP do { ok++; } while (0) | 108 | #define OKPP do { ok++; } while (0) |
104 | #endif | 109 | #endif |
105 | 110 | ||
106 | struct TestMessage { | 111 | struct TestMessage |
112 | { | ||
107 | struct GNUNET_MessageHeader header; | 113 | struct GNUNET_MessageHeader header; |
108 | uint32_t num GNUNET_PACKED; | 114 | uint32_t num GNUNET_PACKED; |
109 | uint8_t pad[MESSAGESIZE]; | 115 | uint8_t pad[MESSAGESIZE]; |
@@ -111,71 +117,71 @@ struct TestMessage { | |||
111 | 117 | ||
112 | 118 | ||
113 | static void | 119 | static void |
114 | terminate_peer(struct PeerContext *p) | 120 | terminate_peer (struct PeerContext *p) |
115 | { | 121 | { |
116 | if (NULL != p->ch) | 122 | if (NULL != p->ch) |
117 | { | 123 | { |
118 | GNUNET_CORE_disconnect(p->ch); | 124 | GNUNET_CORE_disconnect (p->ch); |
119 | p->ch = NULL; | 125 | p->ch = NULL; |
120 | } | 126 | } |
121 | if (NULL != p->ghh) | 127 | if (NULL != p->ghh) |
122 | { | 128 | { |
123 | GNUNET_TRANSPORT_hello_get_cancel(p->ghh); | 129 | GNUNET_TRANSPORT_hello_get_cancel (p->ghh); |
124 | p->ghh = NULL; | 130 | p->ghh = NULL; |
125 | } | 131 | } |
126 | if (NULL != p->oh) | 132 | if (NULL != p->oh) |
127 | { | 133 | { |
128 | GNUNET_TRANSPORT_offer_hello_cancel(p->oh); | 134 | GNUNET_TRANSPORT_offer_hello_cancel (p->oh); |
129 | p->oh = NULL; | 135 | p->oh = NULL; |
130 | } | 136 | } |
131 | if (NULL != p->ats_sh) | 137 | if (NULL != p->ats_sh) |
132 | { | 138 | { |
133 | GNUNET_ATS_connectivity_suggest_cancel(p->ats_sh); | 139 | GNUNET_ATS_connectivity_suggest_cancel (p->ats_sh); |
134 | p->ats_sh = NULL; | 140 | p->ats_sh = NULL; |
135 | } | 141 | } |
136 | if (NULL != p->ats) | 142 | if (NULL != p->ats) |
137 | { | 143 | { |
138 | GNUNET_ATS_connectivity_done(p->ats); | 144 | GNUNET_ATS_connectivity_done (p->ats); |
139 | p->ats = NULL; | 145 | p->ats = NULL; |
140 | } | 146 | } |
141 | if (NULL != p->stats) | 147 | if (NULL != p->stats) |
142 | { | 148 | { |
143 | GNUNET_STATISTICS_destroy(p->stats, GNUNET_NO); | 149 | GNUNET_STATISTICS_destroy (p->stats, GNUNET_NO); |
144 | p->stats = NULL; | 150 | p->stats = NULL; |
145 | } | 151 | } |
146 | if (NULL != p->hello) | 152 | if (NULL != p->hello) |
147 | { | 153 | { |
148 | GNUNET_free(p->hello); | 154 | GNUNET_free (p->hello); |
149 | p->hello = NULL; | 155 | p->hello = NULL; |
150 | } | 156 | } |
151 | } | 157 | } |
152 | 158 | ||
153 | 159 | ||
154 | static void | 160 | static void |
155 | shutdown_task(void *cls) | 161 | shutdown_task (void *cls) |
156 | { | 162 | { |
157 | if (NULL != err_task) | 163 | if (NULL != err_task) |
158 | { | 164 | { |
159 | GNUNET_SCHEDULER_cancel(err_task); | 165 | GNUNET_SCHEDULER_cancel (err_task); |
160 | err_task = NULL; | 166 | err_task = NULL; |
161 | } | 167 | } |
162 | if (NULL != measure_task) | 168 | if (NULL != measure_task) |
163 | { | 169 | { |
164 | GNUNET_SCHEDULER_cancel(measure_task); | 170 | GNUNET_SCHEDULER_cancel (measure_task); |
165 | measure_task = NULL; | 171 | measure_task = NULL; |
166 | } | 172 | } |
167 | terminate_peer(&p1); | 173 | terminate_peer (&p1); |
168 | terminate_peer(&p2); | 174 | terminate_peer (&p2); |
169 | } | 175 | } |
170 | 176 | ||
171 | 177 | ||
172 | static void | 178 | static void |
173 | terminate_task_error(void *cls) | 179 | terminate_task_error (void *cls) |
174 | { | 180 | { |
175 | err_task = NULL; | 181 | err_task = NULL; |
176 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 182 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
177 | "Testcase failed (timeout)!\n"); | 183 | "Testcase failed (timeout)!\n"); |
178 | GNUNET_SCHEDULER_shutdown(); | 184 | GNUNET_SCHEDULER_shutdown (); |
179 | ok = 42; | 185 | ok = 42; |
180 | } | 186 | } |
181 | 187 | ||
@@ -191,28 +197,28 @@ terminate_task_error(void *cls) | |||
191 | * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration | 197 | * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration |
192 | */ | 198 | */ |
193 | static int | 199 | static int |
194 | print_stat(void *cls, | 200 | print_stat (void *cls, |
195 | const char *subsystem, | 201 | const char *subsystem, |
196 | const char *name, | 202 | const char *name, |
197 | uint64_t value, | 203 | uint64_t value, |
198 | int is_persistent) | 204 | int is_persistent) |
199 | { | 205 | { |
200 | if (cls == &p1) | 206 | if (cls == &p1) |
201 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
202 | "Peer1 %50s = %12llu\n", | 208 | "Peer1 %50s = %12llu\n", |
203 | name, | 209 | name, |
204 | (unsigned long long)value); | 210 | (unsigned long long) value); |
205 | if (cls == &p2) | 211 | if (cls == &p2) |
206 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
207 | "Peer2 %50s = %12llu\n", | 213 | "Peer2 %50s = %12llu\n", |
208 | name, | 214 | name, |
209 | (unsigned long long)value); | 215 | (unsigned long long) value); |
210 | return GNUNET_OK; | 216 | return GNUNET_OK; |
211 | } | 217 | } |
212 | 218 | ||
213 | 219 | ||
214 | static void | 220 | static void |
215 | measurement_stop(void *cls) | 221 | measurement_stop (void *cls) |
216 | { | 222 | { |
217 | unsigned long long delta; | 223 | unsigned long long delta; |
218 | unsigned long long throughput_out; | 224 | unsigned long long throughput_out; |
@@ -223,17 +229,17 @@ measurement_stop(void *cls) | |||
223 | enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG; | 229 | enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG; |
224 | 230 | ||
225 | measure_task = NULL; | 231 | measure_task = NULL; |
226 | fprintf(stdout, "%s", "\n"); | 232 | fprintf (stdout, "%s", "\n"); |
227 | running = GNUNET_NO; | 233 | running = GNUNET_NO; |
228 | 234 | ||
229 | delta = GNUNET_TIME_absolute_get_duration(start_time).rel_value_us; | 235 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
230 | if (0 == delta) | 236 | if (0 == delta) |
231 | delta = 1; | 237 | delta = 1; |
232 | throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */ | 238 | throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */ |
233 | throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */ | 239 | throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */ |
234 | 240 | ||
235 | max_quota_in = GNUNET_MIN(current_quota_p1_in, current_quota_p2_in); | 241 | max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in); |
236 | max_quota_out = GNUNET_MIN(current_quota_p1_out, current_quota_p2_out); | 242 | max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out); |
237 | if (max_quota_out < max_quota_in) | 243 | if (max_quota_out < max_quota_in) |
238 | quota_delta = max_quota_in / 3; | 244 | quota_delta = max_quota_in / 3; |
239 | else | 245 | else |
@@ -244,170 +250,170 @@ measurement_stop(void *cls) | |||
244 | ok = 1; /* fail */ | 250 | ok = 1; /* fail */ |
245 | else | 251 | else |
246 | ok = 0; /* pass */ | 252 | ok = 0; /* pass */ |
247 | GNUNET_STATISTICS_get(p1.stats, | 253 | GNUNET_STATISTICS_get (p1.stats, |
248 | "core", | 254 | "core", |
249 | "# discarded CORE_SEND requests", | 255 | "# discarded CORE_SEND requests", |
250 | NULL, | 256 | NULL, |
251 | &print_stat, | 257 | &print_stat, |
252 | &p1); | 258 | &p1); |
253 | GNUNET_STATISTICS_get(p1.stats, | 259 | GNUNET_STATISTICS_get (p1.stats, |
254 | "core", | 260 | "core", |
255 | "# discarded CORE_SEND request bytes", | 261 | "# discarded CORE_SEND request bytes", |
256 | NULL, | 262 | NULL, |
257 | &print_stat, | 263 | &print_stat, |
258 | &p1); | 264 | &p1); |
259 | GNUNET_STATISTICS_get(p1.stats, | 265 | GNUNET_STATISTICS_get (p1.stats, |
260 | "core", | 266 | "core", |
261 | "# discarded lower priority CORE_SEND requests", | 267 | "# discarded lower priority CORE_SEND requests", |
262 | NULL, | 268 | NULL, |
263 | &print_stat, | 269 | &print_stat, |
264 | NULL); | 270 | NULL); |
265 | GNUNET_STATISTICS_get(p1.stats, | 271 | GNUNET_STATISTICS_get (p1.stats, |
266 | "core", | 272 | "core", |
267 | "# discarded lower priority CORE_SEND request bytes", | 273 | "# discarded lower priority CORE_SEND request bytes", |
268 | NULL, | 274 | NULL, |
269 | &print_stat, | 275 | &print_stat, |
270 | &p1); | 276 | &p1); |
271 | GNUNET_STATISTICS_get(p2.stats, | 277 | GNUNET_STATISTICS_get (p2.stats, |
272 | "core", | 278 | "core", |
273 | "# discarded CORE_SEND requests", | 279 | "# discarded CORE_SEND requests", |
274 | NULL, | 280 | NULL, |
275 | &print_stat, | 281 | &print_stat, |
276 | &p2); | 282 | &p2); |
277 | 283 | ||
278 | GNUNET_STATISTICS_get(p2.stats, | 284 | GNUNET_STATISTICS_get (p2.stats, |
279 | "core", | 285 | "core", |
280 | "# discarded CORE_SEND request bytes", | 286 | "# discarded CORE_SEND request bytes", |
281 | NULL, | 287 | NULL, |
282 | &print_stat, | 288 | &print_stat, |
283 | &p2); | 289 | &p2); |
284 | GNUNET_STATISTICS_get(p2.stats, | 290 | GNUNET_STATISTICS_get (p2.stats, |
285 | "core", | 291 | "core", |
286 | "# discarded lower priority CORE_SEND requests", | 292 | "# discarded lower priority CORE_SEND requests", |
287 | NULL, | 293 | NULL, |
288 | &print_stat, | 294 | &print_stat, |
289 | &p2); | 295 | &p2); |
290 | GNUNET_STATISTICS_get(p2.stats, | 296 | GNUNET_STATISTICS_get (p2.stats, |
291 | "core", | 297 | "core", |
292 | "# discarded lower priority CORE_SEND request bytes", | 298 | "# discarded lower priority CORE_SEND request bytes", |
293 | NULL, | 299 | NULL, |
294 | &print_stat, | 300 | &print_stat, |
295 | &p2); | 301 | &p2); |
296 | 302 | ||
297 | if (ok != 0) | 303 | if (ok != 0) |
298 | kind = GNUNET_ERROR_TYPE_ERROR; | 304 | kind = GNUNET_ERROR_TYPE_ERROR; |
299 | switch (test) | 305 | switch (test) |
300 | { | 306 | { |
301 | case SYMMETRIC: | 307 | case SYMMETRIC: |
302 | GNUNET_log(kind, | 308 | GNUNET_log (kind, |
303 | "Core quota compliance test with symmetric quotas: %s\n", | 309 | "Core quota compliance test with symmetric quotas: %s\n", |
304 | (0 == ok) ? "PASSED" : "FAILED"); | 310 | (0 == ok) ? "PASSED" : "FAILED"); |
305 | break; | 311 | break; |
306 | 312 | ||
307 | case ASYMMETRIC_SEND_LIMITED: | 313 | case ASYMMETRIC_SEND_LIMITED: |
308 | GNUNET_log(kind, | 314 | GNUNET_log (kind, |
309 | "Core quota compliance test with limited sender quota: %s\n", | 315 | "Core quota compliance test with limited sender quota: %s\n", |
310 | (0 == ok) ? "PASSED" : "FAILED"); | 316 | (0 == ok) ? "PASSED" : "FAILED"); |
311 | break; | 317 | break; |
312 | 318 | ||
313 | case ASYMMETRIC_RECV_LIMITED: | 319 | case ASYMMETRIC_RECV_LIMITED: |
314 | GNUNET_log(kind, | 320 | GNUNET_log (kind, |
315 | "Core quota compliance test with limited receiver quota: %s\n", | 321 | "Core quota compliance test with limited receiver quota: %s\n", |
316 | (0 == ok) ? "PASSED" : "FAILED"); | 322 | (0 == ok) ? "PASSED" : "FAILED"); |
317 | break; | 323 | break; |
318 | } | 324 | } |
319 | ; | 325 | ; |
320 | GNUNET_log(kind, | 326 | GNUNET_log (kind, |
321 | "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n", | 327 | "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n", |
322 | throughput_out, | 328 | throughput_out, |
323 | total_bytes_sent, | 329 | total_bytes_sent, |
324 | delta); | 330 | delta); |
325 | GNUNET_log(kind, | 331 | GNUNET_log (kind, |
326 | "Peer 1 send quota: %llu b/s\n", | 332 | "Peer 1 send quota: %llu b/s\n", |
327 | current_quota_p1_out); | 333 | current_quota_p1_out); |
328 | GNUNET_log(kind, | 334 | GNUNET_log (kind, |
329 | "Peer 2 receive rate: %llu b/s (%llu bytes in %llu ms)\n", | 335 | "Peer 2 receive rate: %llu b/s (%llu bytes in %llu ms)\n", |
330 | throughput_in, | 336 | throughput_in, |
331 | total_bytes_recv, | 337 | total_bytes_recv, |
332 | delta); | 338 | delta); |
333 | GNUNET_log(kind, | 339 | GNUNET_log (kind, |
334 | "Peer 2 receive quota: %llu b/s\n", | 340 | "Peer 2 receive quota: %llu b/s\n", |
335 | current_quota_p2_in); | 341 | current_quota_p2_in); |
336 | /* | 342 | /* |
337 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. inbound quota allowed: %llu b/s\n",max_quota_in ); | 343 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. inbound quota allowed: %llu b/s\n",max_quota_in ); |
338 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. outbound quota allowed: %llu b/s\n",max_quota_out); | 344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. outbound quota allowed: %llu b/s\n",max_quota_out); |
339 | */ | 345 | */ |
340 | GNUNET_SCHEDULER_shutdown(); | 346 | GNUNET_SCHEDULER_shutdown (); |
341 | } | 347 | } |
342 | 348 | ||
343 | 349 | ||
344 | static void | 350 | static void |
345 | do_transmit(void *cls) | 351 | do_transmit (void *cls) |
346 | { | 352 | { |
347 | struct TestMessage *hdr; | 353 | struct TestMessage *hdr; |
348 | struct GNUNET_MQ_Envelope *env; | 354 | struct GNUNET_MQ_Envelope *env; |
349 | 355 | ||
350 | env = GNUNET_MQ_msg(hdr, | 356 | env = GNUNET_MQ_msg (hdr, |
351 | MTYPE); | 357 | MTYPE); |
352 | hdr->num = htonl(tr_n); | 358 | hdr->num = htonl (tr_n); |
353 | memset(&hdr->pad, | 359 | memset (&hdr->pad, |
354 | tr_n, | 360 | tr_n, |
355 | MESSAGESIZE); | 361 | MESSAGESIZE); |
356 | tr_n++; | 362 | tr_n++; |
357 | GNUNET_SCHEDULER_cancel(err_task); | 363 | GNUNET_SCHEDULER_cancel (err_task); |
358 | err_task = | 364 | err_task = |
359 | GNUNET_SCHEDULER_add_delayed(TIMEOUT, | 365 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
360 | &terminate_task_error, | 366 | &terminate_task_error, |
361 | NULL); | 367 | NULL); |
362 | total_bytes_sent += sizeof(struct TestMessage); | 368 | total_bytes_sent += sizeof(struct TestMessage); |
363 | GNUNET_MQ_send(p1.mq, | 369 | GNUNET_MQ_send (p1.mq, |
364 | env); | 370 | env); |
365 | } | 371 | } |
366 | 372 | ||
367 | 373 | ||
368 | static void * | 374 | static void * |
369 | connect_notify(void *cls, | 375 | connect_notify (void *cls, |
370 | const struct GNUNET_PeerIdentity *peer, | 376 | const struct GNUNET_PeerIdentity *peer, |
371 | struct GNUNET_MQ_Handle *mq) | 377 | struct GNUNET_MQ_Handle *mq) |
372 | { | 378 | { |
373 | struct PeerContext *pc = cls; | 379 | struct PeerContext *pc = cls; |
374 | 380 | ||
375 | if (0 == memcmp(&pc->id, | 381 | if (0 == memcmp (&pc->id, |
376 | peer, | 382 | peer, |
377 | sizeof(struct GNUNET_PeerIdentity))) | 383 | sizeof(struct GNUNET_PeerIdentity))) |
378 | return NULL; /* loopback */ | 384 | return NULL; /* loopback */ |
379 | GNUNET_assert(0 == pc->connect_status); | 385 | GNUNET_assert (0 == pc->connect_status); |
380 | pc->connect_status = 1; | 386 | pc->connect_status = 1; |
381 | pc->mq = mq; | 387 | pc->mq = mq; |
382 | if (pc == &p1) | 388 | if (pc == &p1) |
383 | { | 389 | { |
384 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 390 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
385 | "Encrypted connection established to peer `%s'\n", | 391 | "Encrypted connection established to peer `%s'\n", |
386 | GNUNET_i2s(peer)); | 392 | GNUNET_i2s (peer)); |
387 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
388 | "Asking core (1) for transmission to peer `%s'\n", | 394 | "Asking core (1) for transmission to peer `%s'\n", |
389 | GNUNET_i2s(&p2.id)); | 395 | GNUNET_i2s (&p2.id)); |
390 | GNUNET_SCHEDULER_cancel(err_task); | 396 | GNUNET_SCHEDULER_cancel (err_task); |
391 | err_task = | 397 | err_task = |
392 | GNUNET_SCHEDULER_add_delayed(TIMEOUT, | 398 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
393 | &terminate_task_error, | 399 | &terminate_task_error, |
394 | NULL); | 400 | NULL); |
395 | start_time = GNUNET_TIME_absolute_get(); | 401 | start_time = GNUNET_TIME_absolute_get (); |
396 | running = GNUNET_YES; | 402 | running = GNUNET_YES; |
397 | measure_task = | 403 | measure_task = |
398 | GNUNET_SCHEDULER_add_delayed(MEASUREMENT_LENGTH, | 404 | GNUNET_SCHEDULER_add_delayed (MEASUREMENT_LENGTH, |
399 | &measurement_stop, | 405 | &measurement_stop, |
400 | NULL); | 406 | NULL); |
401 | do_transmit(NULL); | 407 | do_transmit (NULL); |
402 | } | 408 | } |
403 | return pc; | 409 | return pc; |
404 | } | 410 | } |
405 | 411 | ||
406 | 412 | ||
407 | static void | 413 | static void |
408 | disconnect_notify(void *cls, | 414 | disconnect_notify (void *cls, |
409 | const struct GNUNET_PeerIdentity *peer, | 415 | const struct GNUNET_PeerIdentity *peer, |
410 | void *internal_cls) | 416 | void *internal_cls) |
411 | { | 417 | { |
412 | struct PeerContext *pc = cls; | 418 | struct PeerContext *pc = cls; |
413 | 419 | ||
@@ -416,99 +422,99 @@ disconnect_notify(void *cls, | |||
416 | pc->connect_status = 0; | 422 | pc->connect_status = 0; |
417 | pc->mq = NULL; | 423 | pc->mq = NULL; |
418 | if (NULL != measure_task) | 424 | if (NULL != measure_task) |
419 | { | 425 | { |
420 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 426 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
421 | "Measurement aborted due to disconnect!\n"); | 427 | "Measurement aborted due to disconnect!\n"); |
422 | GNUNET_SCHEDULER_cancel(measure_task); | 428 | GNUNET_SCHEDULER_cancel (measure_task); |
423 | measure_task = NULL; | 429 | measure_task = NULL; |
424 | } | 430 | } |
425 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
426 | "Encrypted connection to `%s' cut\n", | 432 | "Encrypted connection to `%s' cut\n", |
427 | GNUNET_i2s(peer)); | 433 | GNUNET_i2s (peer)); |
428 | } | 434 | } |
429 | 435 | ||
430 | 436 | ||
431 | 437 | ||
432 | static void | 438 | static void |
433 | handle_test(void *cls, | 439 | handle_test (void *cls, |
434 | const struct TestMessage *hdr) | 440 | const struct TestMessage *hdr) |
435 | { | 441 | { |
436 | static int n; | 442 | static int n; |
437 | 443 | ||
438 | total_bytes_recv += sizeof(struct TestMessage); | 444 | total_bytes_recv += sizeof(struct TestMessage); |
439 | if (ntohl(hdr->num) != n) | 445 | if (ntohl (hdr->num) != n) |
440 | { | 446 | { |
441 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 447 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
442 | "Expected message %u, got message %u\n", | 448 | "Expected message %u, got message %u\n", |
443 | n, | 449 | n, |
444 | ntohl(hdr->num)); | 450 | ntohl (hdr->num)); |
445 | GNUNET_SCHEDULER_cancel(err_task); | 451 | GNUNET_SCHEDULER_cancel (err_task); |
446 | err_task = GNUNET_SCHEDULER_add_now(&terminate_task_error, | 452 | err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, |
447 | NULL); | 453 | NULL); |
448 | return; | 454 | return; |
449 | } | 455 | } |
450 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 456 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
451 | "Got message %u\n", | 457 | "Got message %u\n", |
452 | ntohl(hdr->num)); | 458 | ntohl (hdr->num)); |
453 | n++; | 459 | n++; |
454 | if (0 == (n % 10)) | 460 | if (0 == (n % 10)) |
455 | fprintf(stderr, "%s", "."); | 461 | fprintf (stderr, "%s", "."); |
456 | 462 | ||
457 | if (GNUNET_YES == running) | 463 | if (GNUNET_YES == running) |
458 | do_transmit(NULL); | 464 | do_transmit (NULL); |
459 | } | 465 | } |
460 | 466 | ||
461 | 467 | ||
462 | static void | 468 | static void |
463 | init_notify(void *cls, | 469 | init_notify (void *cls, |
464 | const struct GNUNET_PeerIdentity *my_identity) | 470 | const struct GNUNET_PeerIdentity *my_identity) |
465 | { | 471 | { |
466 | struct PeerContext *p = cls; | 472 | struct PeerContext *p = cls; |
467 | struct GNUNET_MQ_MessageHandler handlers[] = { | 473 | struct GNUNET_MQ_MessageHandler handlers[] = { |
468 | GNUNET_MQ_hd_fixed_size(test, | 474 | GNUNET_MQ_hd_fixed_size (test, |
469 | MTYPE, | 475 | MTYPE, |
470 | struct TestMessage, | 476 | struct TestMessage, |
471 | NULL), | 477 | NULL), |
472 | GNUNET_MQ_handler_end() | 478 | GNUNET_MQ_handler_end () |
473 | }; | 479 | }; |
474 | 480 | ||
475 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 481 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
476 | "Connection to CORE service of `%s' established\n", | 482 | "Connection to CORE service of `%s' established\n", |
477 | GNUNET_i2s(my_identity)); | 483 | GNUNET_i2s (my_identity)); |
478 | GNUNET_assert(NULL != my_identity); | 484 | GNUNET_assert (NULL != my_identity); |
479 | p->id = *my_identity; | 485 | p->id = *my_identity; |
480 | if (cls == &p1) | 486 | if (cls == &p1) |
481 | { | 487 | { |
482 | GNUNET_assert(ok == 2); | 488 | GNUNET_assert (ok == 2); |
483 | OKPP; | 489 | OKPP; |
484 | /* connect p2 */ | 490 | /* connect p2 */ |
485 | p2.ch = GNUNET_CORE_connect(p2.cfg, | 491 | p2.ch = GNUNET_CORE_connect (p2.cfg, |
486 | &p2, | 492 | &p2, |
487 | &init_notify, | 493 | &init_notify, |
488 | &connect_notify, | 494 | &connect_notify, |
489 | &disconnect_notify, | 495 | &disconnect_notify, |
490 | handlers); | 496 | handlers); |
491 | } | 497 | } |
492 | else | 498 | else |
493 | { | 499 | { |
494 | GNUNET_assert(ok == 3); | 500 | GNUNET_assert (ok == 3); |
495 | OKPP; | 501 | OKPP; |
496 | GNUNET_assert(cls == &p2); | 502 | GNUNET_assert (cls == &p2); |
497 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 503 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
498 | "Asking core (1) to connect to peer `%s' and vice-versa\n", | 504 | "Asking core (1) to connect to peer `%s' and vice-versa\n", |
499 | GNUNET_i2s(&p2.id)); | 505 | GNUNET_i2s (&p2.id)); |
500 | p1.ats_sh = GNUNET_ATS_connectivity_suggest(p1.ats, | 506 | p1.ats_sh = GNUNET_ATS_connectivity_suggest (p1.ats, |
501 | &p2.id, | 507 | &p2.id, |
502 | 1); | 508 | 1); |
503 | p2.ats_sh = GNUNET_ATS_connectivity_suggest(p2.ats, | 509 | p2.ats_sh = GNUNET_ATS_connectivity_suggest (p2.ats, |
504 | &p1.id, | 510 | &p1.id, |
505 | 1); | 511 | 1); |
506 | } | 512 | } |
507 | } | 513 | } |
508 | 514 | ||
509 | 515 | ||
510 | static void | 516 | static void |
511 | offer_hello_done(void *cls) | 517 | offer_hello_done (void *cls) |
512 | { | 518 | { |
513 | struct PeerContext *p = cls; | 519 | struct PeerContext *p = cls; |
514 | 520 | ||
@@ -517,175 +523,175 @@ offer_hello_done(void *cls) | |||
517 | 523 | ||
518 | 524 | ||
519 | static void | 525 | static void |
520 | process_hello(void *cls, | 526 | process_hello (void *cls, |
521 | const struct GNUNET_MessageHeader *message) | 527 | const struct GNUNET_MessageHeader *message) |
522 | { | 528 | { |
523 | struct PeerContext *p = cls; | 529 | struct PeerContext *p = cls; |
524 | 530 | ||
525 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
526 | "Received (my) HELLO from transport service\n"); | 532 | "Received (my) HELLO from transport service\n"); |
527 | GNUNET_assert(message != NULL); | 533 | GNUNET_assert (message != NULL); |
528 | p->hello = GNUNET_malloc(ntohs(message->size)); | 534 | p->hello = GNUNET_malloc (ntohs (message->size)); |
529 | GNUNET_memcpy(p->hello, message, ntohs(message->size)); | 535 | GNUNET_memcpy (p->hello, message, ntohs (message->size)); |
530 | if ((p == &p1) && | 536 | if ((p == &p1) && |
531 | (NULL == p2.oh)) | 537 | (NULL == p2.oh)) |
532 | p2.oh = GNUNET_TRANSPORT_offer_hello(p2.cfg, | 538 | p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg, |
533 | message, | 539 | message, |
534 | &offer_hello_done, | 540 | &offer_hello_done, |
535 | &p2); | 541 | &p2); |
536 | if ((p == &p2) && | 542 | if ((p == &p2) && |
537 | (NULL == p1.oh)) | 543 | (NULL == p1.oh)) |
538 | p1.oh = GNUNET_TRANSPORT_offer_hello(p1.cfg, message, | 544 | p1.oh = GNUNET_TRANSPORT_offer_hello (p1.cfg, message, |
539 | &offer_hello_done, | 545 | &offer_hello_done, |
540 | &p1); | 546 | &p1); |
541 | 547 | ||
542 | if ((p == &p1) && | 548 | if ((p == &p1) && |
543 | (NULL != p2.hello) && | 549 | (NULL != p2.hello) && |
544 | (NULL == p1.oh)) | 550 | (NULL == p1.oh)) |
545 | p1.oh = GNUNET_TRANSPORT_offer_hello(p1.cfg, | 551 | p1.oh = GNUNET_TRANSPORT_offer_hello (p1.cfg, |
546 | p2.hello, | 552 | p2.hello, |
547 | &offer_hello_done, | 553 | &offer_hello_done, |
548 | &p1); | 554 | &p1); |
549 | if ((p == &p2) && | 555 | if ((p == &p2) && |
550 | (NULL != p1.hello) && | 556 | (NULL != p1.hello) && |
551 | (NULL == p2.oh)) | 557 | (NULL == p2.oh)) |
552 | p2.oh = GNUNET_TRANSPORT_offer_hello(p2.cfg, | 558 | p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg, |
553 | p1.hello, | 559 | p1.hello, |
554 | &offer_hello_done, | 560 | &offer_hello_done, |
555 | &p2); | 561 | &p2); |
556 | } | 562 | } |
557 | 563 | ||
558 | 564 | ||
559 | static void | 565 | static void |
560 | setup_peer(struct PeerContext *p, | 566 | setup_peer (struct PeerContext *p, |
561 | const char *cfgname) | 567 | const char *cfgname) |
562 | { | 568 | { |
563 | char *binary; | 569 | char *binary; |
564 | 570 | ||
565 | binary = GNUNET_OS_get_libexec_binary_path("gnunet-service-arm"); | 571 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); |
566 | p->cfg = GNUNET_CONFIGURATION_create(); | 572 | p->cfg = GNUNET_CONFIGURATION_create (); |
567 | p->arm_proc = | 573 | p->arm_proc = |
568 | GNUNET_OS_start_process(GNUNET_YES, | 574 | GNUNET_OS_start_process (GNUNET_YES, |
569 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | 575 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
570 | NULL, NULL, NULL, | 576 | NULL, NULL, NULL, |
571 | binary, | 577 | binary, |
572 | "gnunet-service-arm", | 578 | "gnunet-service-arm", |
573 | "-c", | 579 | "-c", |
574 | cfgname, | 580 | cfgname, |
575 | NULL); | 581 | NULL); |
576 | GNUNET_assert(GNUNET_OK == | 582 | GNUNET_assert (GNUNET_OK == |
577 | GNUNET_CONFIGURATION_load(p->cfg, | 583 | GNUNET_CONFIGURATION_load (p->cfg, |
578 | cfgname)); | 584 | cfgname)); |
579 | p->stats = GNUNET_STATISTICS_create("core", | 585 | p->stats = GNUNET_STATISTICS_create ("core", |
580 | p->cfg); | 586 | p->cfg); |
581 | GNUNET_assert(NULL != p->stats); | 587 | GNUNET_assert (NULL != p->stats); |
582 | p->ats = GNUNET_ATS_connectivity_init(p->cfg); | 588 | p->ats = GNUNET_ATS_connectivity_init (p->cfg); |
583 | GNUNET_assert(NULL != p->ats); | 589 | GNUNET_assert (NULL != p->ats); |
584 | p->ghh = GNUNET_TRANSPORT_hello_get(p->cfg, | 590 | p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg, |
585 | GNUNET_TRANSPORT_AC_ANY, | 591 | GNUNET_TRANSPORT_AC_ANY, |
586 | &process_hello, | 592 | &process_hello, |
587 | p); | 593 | p); |
588 | GNUNET_free(binary); | 594 | GNUNET_free (binary); |
589 | } | 595 | } |
590 | 596 | ||
591 | 597 | ||
592 | static void | 598 | static void |
593 | run(void *cls, | 599 | run (void *cls, |
594 | char *const *args, | 600 | char *const *args, |
595 | const char *cfgfile, | 601 | const char *cfgfile, |
596 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 602 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
597 | { | 603 | { |
598 | struct GNUNET_MQ_MessageHandler handlers[] = { | 604 | struct GNUNET_MQ_MessageHandler handlers[] = { |
599 | GNUNET_MQ_hd_fixed_size(test, | 605 | GNUNET_MQ_hd_fixed_size (test, |
600 | MTYPE, | 606 | MTYPE, |
601 | struct TestMessage, | 607 | struct TestMessage, |
602 | NULL), | 608 | NULL), |
603 | GNUNET_MQ_handler_end() | 609 | GNUNET_MQ_handler_end () |
604 | }; | 610 | }; |
605 | 611 | ||
606 | GNUNET_assert(ok == 1); | 612 | GNUNET_assert (ok == 1); |
607 | OKPP; | 613 | OKPP; |
608 | err_task = | 614 | err_task = |
609 | GNUNET_SCHEDULER_add_delayed(TIMEOUT, | 615 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
610 | &terminate_task_error, | 616 | &terminate_task_error, |
617 | NULL); | ||
618 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
611 | NULL); | 619 | NULL); |
612 | GNUNET_SCHEDULER_add_shutdown(&shutdown_task, | ||
613 | NULL); | ||
614 | if (test == SYMMETRIC) | 620 | if (test == SYMMETRIC) |
615 | { | 621 | { |
616 | setup_peer(&p1, | 622 | setup_peer (&p1, |
617 | "test_core_quota_peer1.conf"); | 623 | "test_core_quota_peer1.conf"); |
618 | setup_peer(&p2, | 624 | setup_peer (&p2, |
619 | "test_core_quota_peer2.conf"); | 625 | "test_core_quota_peer2.conf"); |
620 | } | 626 | } |
621 | else if (test == ASYMMETRIC_SEND_LIMITED) | 627 | else if (test == ASYMMETRIC_SEND_LIMITED) |
622 | { | 628 | { |
623 | setup_peer(&p1, | 629 | setup_peer (&p1, |
624 | "test_core_quota_asymmetric_send_limit_peer1.conf"); | 630 | "test_core_quota_asymmetric_send_limit_peer1.conf"); |
625 | setup_peer(&p2, | 631 | setup_peer (&p2, |
626 | "test_core_quota_asymmetric_send_limit_peer2.conf"); | 632 | "test_core_quota_asymmetric_send_limit_peer2.conf"); |
627 | } | 633 | } |
628 | else if (test == ASYMMETRIC_RECV_LIMITED) | 634 | else if (test == ASYMMETRIC_RECV_LIMITED) |
629 | { | 635 | { |
630 | setup_peer(&p1, | 636 | setup_peer (&p1, |
631 | "test_core_quota_asymmetric_recv_limited_peer1.conf"); | 637 | "test_core_quota_asymmetric_recv_limited_peer1.conf"); |
632 | setup_peer(&p2, | 638 | setup_peer (&p2, |
633 | "test_core_quota_asymmetric_recv_limited_peer2.conf"); | 639 | "test_core_quota_asymmetric_recv_limited_peer2.conf"); |
634 | } | 640 | } |
635 | 641 | ||
636 | GNUNET_assert(test != -1); | 642 | GNUNET_assert (test != -1); |
637 | GNUNET_assert(GNUNET_SYSERR != | 643 | GNUNET_assert (GNUNET_SYSERR != |
638 | GNUNET_CONFIGURATION_get_value_size(p1.cfg, | 644 | GNUNET_CONFIGURATION_get_value_size (p1.cfg, |
639 | "ATS", | 645 | "ATS", |
640 | "WAN_QUOTA_IN", | 646 | "WAN_QUOTA_IN", |
641 | ¤t_quota_p1_in)); | 647 | ¤t_quota_p1_in)); |
642 | GNUNET_assert(GNUNET_SYSERR != | 648 | GNUNET_assert (GNUNET_SYSERR != |
643 | GNUNET_CONFIGURATION_get_value_size(p2.cfg, | 649 | GNUNET_CONFIGURATION_get_value_size (p2.cfg, |
644 | "ATS", | 650 | "ATS", |
645 | "WAN_QUOTA_IN", | 651 | "WAN_QUOTA_IN", |
646 | ¤t_quota_p2_in)); | 652 | ¤t_quota_p2_in)); |
647 | GNUNET_assert(GNUNET_SYSERR != | 653 | GNUNET_assert (GNUNET_SYSERR != |
648 | GNUNET_CONFIGURATION_get_value_size(p1.cfg, | 654 | GNUNET_CONFIGURATION_get_value_size (p1.cfg, |
649 | "ATS", | 655 | "ATS", |
650 | "WAN_QUOTA_OUT", | 656 | "WAN_QUOTA_OUT", |
651 | ¤t_quota_p1_out)); | 657 | ¤t_quota_p1_out)); |
652 | GNUNET_assert(GNUNET_SYSERR != | 658 | GNUNET_assert (GNUNET_SYSERR != |
653 | GNUNET_CONFIGURATION_get_value_size(p2.cfg, | 659 | GNUNET_CONFIGURATION_get_value_size (p2.cfg, |
654 | "ATS", | 660 | "ATS", |
655 | "WAN_QUOTA_OUT", | 661 | "WAN_QUOTA_OUT", |
656 | ¤t_quota_p2_out)); | 662 | ¤t_quota_p2_out)); |
657 | 663 | ||
658 | p1.ch = GNUNET_CORE_connect(p1.cfg, | 664 | p1.ch = GNUNET_CORE_connect (p1.cfg, |
659 | &p1, | 665 | &p1, |
660 | &init_notify, | 666 | &init_notify, |
661 | &connect_notify, | 667 | &connect_notify, |
662 | &disconnect_notify, | 668 | &disconnect_notify, |
663 | handlers); | 669 | handlers); |
664 | } | 670 | } |
665 | 671 | ||
666 | 672 | ||
667 | static void | 673 | static void |
668 | stop_arm(struct PeerContext *p) | 674 | stop_arm (struct PeerContext *p) |
669 | { | 675 | { |
670 | if (0 != GNUNET_OS_process_kill(p->arm_proc, | 676 | if (0 != GNUNET_OS_process_kill (p->arm_proc, |
671 | GNUNET_TERM_SIG)) | 677 | GNUNET_TERM_SIG)) |
672 | GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, | 678 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, |
673 | "kill"); | 679 | "kill"); |
674 | if (GNUNET_OK != | 680 | if (GNUNET_OK != |
675 | GNUNET_OS_process_wait(p->arm_proc)) | 681 | GNUNET_OS_process_wait (p->arm_proc)) |
676 | GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, | 682 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, |
677 | "waitpid"); | 683 | "waitpid"); |
678 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 684 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
679 | "ARM process %u stopped\n", | 685 | "ARM process %u stopped\n", |
680 | GNUNET_OS_process_get_pid(p->arm_proc)); | 686 | GNUNET_OS_process_get_pid (p->arm_proc)); |
681 | GNUNET_OS_process_destroy(p->arm_proc); | 687 | GNUNET_OS_process_destroy (p->arm_proc); |
682 | p->arm_proc = NULL; | 688 | p->arm_proc = NULL; |
683 | GNUNET_CONFIGURATION_destroy(p->cfg); | 689 | GNUNET_CONFIGURATION_destroy (p->cfg); |
684 | } | 690 | } |
685 | 691 | ||
686 | 692 | ||
687 | static int | 693 | static int |
688 | check() | 694 | check () |
689 | { | 695 | { |
690 | char *const argv[] = { | 696 | char *const argv[] = { |
691 | "test-core-quota-compliance", | 697 | "test-core-quota-compliance", |
@@ -698,75 +704,75 @@ check() | |||
698 | }; | 704 | }; |
699 | 705 | ||
700 | ok = 1; | 706 | ok = 1; |
701 | GNUNET_PROGRAM_run((sizeof(argv) / sizeof(char *)) - 1, | 707 | GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1, |
702 | argv, | 708 | argv, |
703 | "test-core-quota-compliance", | 709 | "test-core-quota-compliance", |
704 | "nohelp", | 710 | "nohelp", |
705 | options, | 711 | options, |
706 | &run, | 712 | &run, |
707 | &ok); | 713 | &ok); |
708 | stop_arm(&p1); | 714 | stop_arm (&p1); |
709 | stop_arm(&p2); | 715 | stop_arm (&p2); |
710 | return ok; | 716 | return ok; |
711 | } | 717 | } |
712 | 718 | ||
713 | 719 | ||
714 | static void | 720 | static void |
715 | cleanup_directory(int test) | 721 | cleanup_directory (int test) |
716 | { | 722 | { |
717 | switch (test) | 723 | switch (test) |
718 | { | 724 | { |
719 | case SYMMETRIC: | 725 | case SYMMETRIC: |
720 | GNUNET_DISK_directory_remove("/tmp/test-gnunet-core-quota-sym-peer-1/"); | 726 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/"); |
721 | GNUNET_DISK_directory_remove("/tmp/test-gnunet-core-quota-sym-peer-2/"); | 727 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/"); |
722 | break; | 728 | break; |
723 | 729 | ||
724 | case ASYMMETRIC_SEND_LIMITED: | 730 | case ASYMMETRIC_SEND_LIMITED: |
725 | GNUNET_DISK_directory_remove | 731 | GNUNET_DISK_directory_remove |
726 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/"); | 732 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/"); |
727 | GNUNET_DISK_directory_remove | 733 | GNUNET_DISK_directory_remove |
728 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/"); | 734 | ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/"); |
729 | break; | 735 | break; |
730 | 736 | ||
731 | case ASYMMETRIC_RECV_LIMITED: | 737 | case ASYMMETRIC_RECV_LIMITED: |
732 | GNUNET_DISK_directory_remove | 738 | GNUNET_DISK_directory_remove |
733 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/"); | 739 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/"); |
734 | GNUNET_DISK_directory_remove | 740 | GNUNET_DISK_directory_remove |
735 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); | 741 | ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/"); |
736 | break; | 742 | break; |
737 | } | 743 | } |
738 | } | 744 | } |
739 | 745 | ||
740 | 746 | ||
741 | int | 747 | int |
742 | main(int argc, | 748 | main (int argc, |
743 | char *argv[]) | 749 | char *argv[]) |
744 | { | 750 | { |
745 | int ret; | 751 | int ret; |
746 | 752 | ||
747 | test = -1; | 753 | test = -1; |
748 | if (NULL != strstr(argv[0], | 754 | if (NULL != strstr (argv[0], |
749 | "_symmetric")) | 755 | "_symmetric")) |
750 | { | 756 | { |
751 | test = SYMMETRIC; | 757 | test = SYMMETRIC; |
752 | } | 758 | } |
753 | else if (NULL != strstr(argv[0], | 759 | else if (NULL != strstr (argv[0], |
754 | "_asymmetric_send")) | 760 | "_asymmetric_send")) |
755 | { | 761 | { |
756 | test = ASYMMETRIC_SEND_LIMITED; | 762 | test = ASYMMETRIC_SEND_LIMITED; |
757 | } | 763 | } |
758 | else if (NULL != strstr(argv[0], | 764 | else if (NULL != strstr (argv[0], |
759 | "_asymmetric_recv")) | 765 | "_asymmetric_recv")) |
760 | { | 766 | { |
761 | test = ASYMMETRIC_RECV_LIMITED; | 767 | test = ASYMMETRIC_RECV_LIMITED; |
762 | } | 768 | } |
763 | GNUNET_assert(test != -1); | 769 | GNUNET_assert (test != -1); |
764 | cleanup_directory(test); | 770 | cleanup_directory (test); |
765 | GNUNET_log_setup("test-core-quota-compliance", | 771 | GNUNET_log_setup ("test-core-quota-compliance", |
766 | "WARNING", | 772 | "WARNING", |
767 | NULL); | 773 | NULL); |
768 | ret = check(); | 774 | ret = check (); |
769 | cleanup_directory(test); | 775 | cleanup_directory (test); |
770 | return ret; | 776 | return ret; |
771 | } | 777 | } |
772 | 778 | ||