2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file core/test_core_quota_compliance.c
22 * @brief testcase for core_api.c focusing quota compliance on core level
25 #include "gnunet_common.h"
26 #include "gnunet_constants.h"
27 #include "gnunet_arm_service.h"
28 #include "gnunet_core_service.h"
29 #include "gnunet_getopt_lib.h"
30 #include "gnunet_os_lib.h"
31 #include "gnunet_program_lib.h"
32 #include "gnunet_scheduler_lib.h"
33 #include "gnunet_transport_service.h"
34 #include "gnunet_statistics_service.h"
36 #define VERBOSE GNUNET_EXTRA_LOGGING
37 #define DEBUG_TRANSMISSION GNUNET_EXTRA_LOGGING
40 #define ASYMMETRIC_SEND_LIMITED 1
41 #define ASYMMETRIC_RECV_LIMITED 2
43 #define START_ARM GNUNET_YES
46 * Note that this value must not significantly exceed
47 * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
48 * messages may be dropped even for a reliable transport.
50 #define TOTAL_MSGS (60000 * 10)
53 * How long until we give up on transmitting the message?
55 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 180)
58 * What delay do we request from the core service for transmission?
60 #define FAST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
63 #define MESSAGESIZE 1024
64 #define MEASUREMENT_LENGTH GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
66 static unsigned long long total_bytes_sent;
67 static unsigned long long total_bytes_recv;
69 static struct GNUNET_TIME_Absolute start_time;
71 static GNUNET_SCHEDULER_TaskIdentifier err_task;
73 static GNUNET_SCHEDULER_TaskIdentifier measure_task;
75 static GNUNET_SCHEDULER_TaskIdentifier connect_task;
80 struct GNUNET_CONFIGURATION_Handle *cfg;
81 struct GNUNET_CORE_Handle *ch;
82 struct GNUNET_CORE_TransmitHandle *nth;
83 struct GNUNET_PeerIdentity id;
84 struct GNUNET_TRANSPORT_Handle *th;
85 struct GNUNET_MessageHeader *hello;
86 struct GNUNET_STATISTICS_Handle *stats;
87 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
90 struct GNUNET_OS_Process *arm_proc;
94 static struct PeerContext p1;
95 static struct PeerContext p2;
97 static unsigned long long current_quota_p1_in;
98 static unsigned long long current_quota_p1_out;
99 static unsigned long long current_quota_p2_in;
100 static unsigned long long current_quota_p2_out;
110 #define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
112 #define OKPP do { ok++; } while (0)
117 struct GNUNET_MessageHeader header;
122 process_hello (void *cls, const struct GNUNET_MessageHeader *message);
125 terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
127 struct GNUNET_CORE_Handle *ch;
129 err_task = GNUNET_SCHEDULER_NO_TASK;
130 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
131 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
134 GNUNET_CORE_notify_transmit_ready_cancel (p1.nth);
137 if (connect_task != GNUNET_SCHEDULER_NO_TASK)
138 GNUNET_SCHEDULER_cancel (connect_task);
141 GNUNET_CORE_disconnect (ch);
144 GNUNET_CORE_disconnect (ch);
145 GNUNET_TRANSPORT_disconnect (p1.th);
147 GNUNET_TRANSPORT_disconnect (p2.th);
153 terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
155 err_task = GNUNET_SCHEDULER_NO_TASK;
157 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Testcase failed!\n");
162 GNUNET_CORE_notify_transmit_ready_cancel (p1.nth);
165 if (measure_task != GNUNET_SCHEDULER_NO_TASK)
166 GNUNET_SCHEDULER_cancel (measure_task);
167 if (connect_task != GNUNET_SCHEDULER_NO_TASK)
168 GNUNET_SCHEDULER_cancel (connect_task);
170 GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
171 GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
173 GNUNET_CORE_disconnect (p1.ch);
175 GNUNET_CORE_disconnect (p2.ch);
177 GNUNET_TRANSPORT_disconnect (p1.th);
179 GNUNET_TRANSPORT_disconnect (p2.th);
186 try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
188 connect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
190 GNUNET_TRANSPORT_try_connect (p1.th, &p2.id);
191 GNUNET_TRANSPORT_try_connect (p2.th, &p1.id);
195 * Callback function to process statistic values.
198 * @param subsystem name of subsystem that created the statistic
199 * @param name the name of the datum
200 * @param value the current value
201 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
202 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
205 print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
209 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer1 %50s = %12llu\n", name,
210 (unsigned long long) value);
212 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer2 %50s = %12llu\n", name,
213 (unsigned long long) value);
218 measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
220 unsigned long long delta;
221 unsigned long long throughput_out;
222 unsigned long long throughput_in;
223 unsigned long long max_quota_in;
224 unsigned long long max_quota_out;
225 unsigned long long quota_delta;
226 enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG;
228 measure_task = GNUNET_SCHEDULER_NO_TASK;
229 fprintf (stdout, "\n");
232 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
234 throughput_out = total_bytes_sent * 1000 / delta; /* convert to bytes/s */
235 throughput_in = total_bytes_recv * 1000 / delta; /* convert to bytes/s */
237 max_quota_in = GNUNET_MIN (current_quota_p1_in,
238 current_quota_p2_in);
239 max_quota_out = GNUNET_MIN (current_quota_p1_out,
240 current_quota_p2_out);
241 if (max_quota_out < max_quota_in)
242 quota_delta = max_quota_in / 10;
244 quota_delta = max_quota_out / 10;
246 if ((throughput_out > (max_quota_out + quota_delta)) ||
247 (throughput_in > (max_quota_in + quota_delta)))
251 GNUNET_STATISTICS_get (p1.stats, "core", "# discarded CORE_SEND requests",
252 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
254 GNUNET_STATISTICS_get (p1.stats, "core",
255 "# discarded CORE_SEND request bytes",
256 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
257 GNUNET_STATISTICS_get (p1.stats, "core",
258 "# discarded lower priority CORE_SEND requests",
259 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, NULL);
260 GNUNET_STATISTICS_get (p1.stats, "core",
261 "# discarded lower priority CORE_SEND request bytes",
262 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p1);
263 GNUNET_STATISTICS_get (p2.stats, "core", "# discarded CORE_SEND requests",
264 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
266 GNUNET_STATISTICS_get (p2.stats, "core",
267 "# discarded CORE_SEND request bytes",
268 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
269 GNUNET_STATISTICS_get (p2.stats, "core",
270 "# discarded lower priority CORE_SEND requests",
271 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
272 GNUNET_STATISTICS_get (p2.stats, "core",
273 "# discarded lower priority CORE_SEND request bytes",
274 GNUNET_TIME_UNIT_FOREVER_REL, NULL, &print_stat, &p2);
277 kind = GNUNET_ERROR_TYPE_ERROR;
281 GNUNET_log (kind, "Core quota compliance test with symmetric quotas: %s\n",
282 (ok != 0) ? "PASSED" : "FAILED");
284 case ASYMMETRIC_SEND_LIMITED:
286 "Core quota compliance test with limited sender quota: %s\n",
287 (ok != 0) ? "PASSED" : "FAILED");
289 case ASYMMETRIC_RECV_LIMITED:
291 "Core quota compliance test with limited receiver quota: %s\n",
292 (ok != 0) ? "PASSED" : "FAILED");
295 GNUNET_log (kind, "Peer 1 send rate: %llu b/s (%llu bytes in %llu ms)\n",
296 throughput_out, total_bytes_sent, delta);
297 GNUNET_log (kind, "Peer 1 send quota: %llu b/s\n",
298 current_quota_p1_out);
299 GNUNET_log (kind, "Peer 2 receive rate: %llu b/s (%llu bytes in %llu ms)\n",
300 throughput_in, total_bytes_recv, delta);
301 GNUNET_log (kind, "Peer 2 receive quota: %llu b/s\n",
302 current_quota_p2_in);
304 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. inbound quota allowed: %llu b/s\n",max_quota_in );
305 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. outbound quota allowed: %llu b/s\n",max_quota_out);
307 GNUNET_SCHEDULER_cancel (err_task);
308 err_task = GNUNET_SCHEDULER_add_now (&terminate_task, NULL);
313 transmit_ready (void *cls, size_t size, void *buf)
316 struct TestMessage hdr;
320 GNUNET_assert (size <= GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE);
323 if ((p1.ch != NULL) && (p1.connect_status == 1))
324 GNUNET_break (NULL !=
325 (p1.nth = GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0,
326 FAST_TIMEOUT, &p2.id,
328 &transmit_ready, &p1)));
331 GNUNET_assert (tr_n < TOTAL_MSGS);
333 GNUNET_assert (size >= MESSAGESIZE);
334 GNUNET_assert (buf != NULL);
338 #if DEBUG_TRANSMISSION
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
340 "Sending message %u of size %u at offset %u\n", tr_n,
343 hdr.header.size = htons (MESSAGESIZE);
344 hdr.header.type = htons (MTYPE);
345 hdr.num = htonl (tr_n);
346 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
347 ret += sizeof (struct TestMessage);
348 memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage));
349 ret += MESSAGESIZE - sizeof (struct TestMessage);
351 if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16))
352 break; /* sometimes pack buffer full, sometimes not */
354 while (size - ret >= MESSAGESIZE);
355 GNUNET_SCHEDULER_cancel (err_task);
357 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
359 total_bytes_sent += ret;
366 connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
367 const struct GNUNET_ATS_Information *atsi)
369 struct PeerContext *pc = cls;
371 if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity)))
372 return; /* loopback */
373 GNUNET_assert (pc->connect_status == 0);
374 pc->connect_status = 1;
377 #if DEBUG_TRANSMISSION
378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
379 "Encrypted connection established to peer `%4s'\n",
381 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
382 "Asking core (1) for transmission to peer `%4s'\n",
383 GNUNET_i2s (&p2.id));
385 if (err_task != GNUNET_SCHEDULER_NO_TASK)
386 GNUNET_SCHEDULER_cancel (err_task);
388 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
389 start_time = GNUNET_TIME_absolute_get ();
390 running = GNUNET_YES;
392 GNUNET_SCHEDULER_add_delayed (MEASUREMENT_LENGTH, &measurement_stop,
395 GNUNET_break (NULL !=
396 (p1.nth = GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0,
399 &transmit_ready, &p1)));
405 disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer)
407 struct PeerContext *pc = cls;
409 if (0 == memcmp (&pc->id, peer, sizeof (struct GNUNET_PeerIdentity)))
410 return; /* loopback */
411 pc->connect_status = 0;
412 if (GNUNET_SCHEDULER_NO_TASK != measure_task)
414 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
415 "Measurement aborted due to disconnect!\n");
416 GNUNET_SCHEDULER_cancel (measure_task);
417 measure_task = GNUNET_SCHEDULER_NO_TASK;
421 GNUNET_CORE_notify_transmit_ready_cancel (pc->nth);
424 #if DEBUG_TRANSMISSION
425 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypted connection to `%4s' cut\n",
432 inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
433 const struct GNUNET_MessageHeader *message,
434 const struct GNUNET_ATS_Information *atsi)
436 #if DEBUG_TRANSMISSION
437 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
438 "Core provides inbound data from `%4s' %llu.\n",
439 GNUNET_i2s (other), ntohs (message->size));
441 total_bytes_recv += ntohs (message->size);
447 outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
448 const struct GNUNET_MessageHeader *message,
449 const struct GNUNET_ATS_Information *atsi)
451 #if DEBUG_TRANSMISSION
452 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
453 "Core notifies about outbound data for `%4s'.\n",
461 transmit_ready (void *cls, size_t size, void *buf);
464 process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
465 const struct GNUNET_MessageHeader *message,
466 const struct GNUNET_ATS_Information *atsi)
469 const struct TestMessage *hdr;
471 hdr = (const struct TestMessage *) message;
472 if (MTYPE != ntohs (message->type))
473 return GNUNET_SYSERR;
474 if (ntohs (message->size) != MESSAGESIZE)
476 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
477 "Expected message %u of size %u, got %u bytes of message %u\n",
478 n, MESSAGESIZE, ntohs (message->size), ntohl (hdr->num));
479 GNUNET_SCHEDULER_cancel (err_task);
480 err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, NULL);
481 return GNUNET_SYSERR;
483 if (ntohl (hdr->num) != n)
485 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
486 "Expected message %u of size %u, got %u bytes of message %u\n",
487 n, MESSAGESIZE, ntohs (message->size), ntohl (hdr->num));
488 GNUNET_SCHEDULER_cancel (err_task);
489 err_task = GNUNET_SCHEDULER_add_now (&terminate_task_error, NULL);
490 return GNUNET_SYSERR;
492 #if DEBUG_TRANSMISSION
493 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got message %u of size %u\n",
494 ntohl (hdr->num), ntohs (message->size));
498 fprintf (stderr, ".");
501 if (running == GNUNET_YES)
502 GNUNET_break (NULL !=
503 GNUNET_CORE_notify_transmit_ready (p1.ch, GNUNET_NO, 0,
504 FAST_TIMEOUT, &p2.id,
506 &transmit_ready, &p1));
511 static struct GNUNET_CORE_MessageHandler handlers[] = {
512 {&process_mtype, MTYPE, 0},
519 init_notify (void *cls, struct GNUNET_CORE_Handle *server,
520 const struct GNUNET_PeerIdentity *my_identity)
522 struct PeerContext *p = cls;
524 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
525 "Connection to CORE service of `%4s' established\n",
526 GNUNET_i2s (my_identity));
527 GNUNET_assert (server != NULL);
528 p->id = *my_identity;
529 GNUNET_assert (p->ch == server);
532 GNUNET_assert (ok == 2);
535 p2.ch = GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
536 &disconnect_notify, &inbound_notify, GNUNET_YES,
537 &outbound_notify, GNUNET_YES, handlers);
541 GNUNET_assert (ok == 3);
543 GNUNET_assert (cls == &p2);
544 #if DEBUG_TRANSMISSION
545 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
546 "Asking core (1) to connect to peer `%4s'\n",
547 GNUNET_i2s (&p2.id));
549 connect_task = GNUNET_SCHEDULER_add_now (&try_connect,
556 process_hello (void *cls, const struct GNUNET_MessageHeader *message)
558 struct PeerContext *p = cls;
561 #if DEBUG_TRANSMISSION
562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
563 "Received (my) `%s' from transport service\n", "HELLO");
565 GNUNET_assert (message != NULL);
566 p->hello = GNUNET_malloc (ntohs (message->size));
567 memcpy (p->hello, message, ntohs (message->size));
568 if ((p == &p1) && (p2.th != NULL))
569 GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
570 if ((p == &p2) && (p1.th != NULL))
571 GNUNET_TRANSPORT_offer_hello (p1.th, message, NULL, NULL);
573 if ((p == &p1) && (p2.hello != NULL))
574 GNUNET_TRANSPORT_offer_hello (p1.th, p2.hello, NULL, NULL);
575 if ((p == &p2) && (p1.hello != NULL))
576 GNUNET_TRANSPORT_offer_hello (p2.th, p1.hello, NULL, NULL);
582 setup_peer (struct PeerContext *p, const char *cfgname)
584 p->cfg = GNUNET_CONFIGURATION_create ();
587 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
588 "gnunet-service-arm",
592 "-c", cfgname, NULL);
594 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
595 p->stats = GNUNET_STATISTICS_create ("core", p->cfg);
596 GNUNET_assert (p->stats != NULL);
597 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
598 GNUNET_assert (p->th != NULL);
599 p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
604 run (void *cls, char *const *args, const char *cfgfile,
605 const struct GNUNET_CONFIGURATION_Handle *cfg)
607 GNUNET_assert (ok == 1);
610 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
611 if (test == SYMMETRIC)
613 setup_peer (&p1, "test_core_quota_peer1.conf");
614 setup_peer (&p2, "test_core_quota_peer2.conf");
616 else if (test == ASYMMETRIC_SEND_LIMITED)
618 setup_peer (&p1, "test_core_quota_asymmetric_send_limit_peer1.conf");
619 setup_peer (&p2, "test_core_quota_asymmetric_send_limit_peer2.conf");
621 else if (test == ASYMMETRIC_RECV_LIMITED)
623 setup_peer (&p1, "test_core_quota_asymmetric_recv_limited_peer1.conf");
624 setup_peer (&p2, "test_core_quota_asymmetric_recv_limited_peer2.conf");
627 GNUNET_assert (test != -1);
628 GNUNET_assert (GNUNET_SYSERR !=
629 GNUNET_CONFIGURATION_get_value_number (p1.cfg, "CORE",
631 ¤t_quota_p1_in));
632 GNUNET_assert (GNUNET_SYSERR !=
633 GNUNET_CONFIGURATION_get_value_number (p2.cfg, "CORE",
635 ¤t_quota_p2_in));
636 GNUNET_assert (GNUNET_SYSERR !=
637 GNUNET_CONFIGURATION_get_value_number (p1.cfg, "CORE",
639 ¤t_quota_p1_out));
640 GNUNET_assert (GNUNET_SYSERR !=
641 GNUNET_CONFIGURATION_get_value_number (p2.cfg, "CORE",
643 ¤t_quota_p2_out));
645 p1.ch = GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
646 &disconnect_notify, &inbound_notify, GNUNET_YES,
647 &outbound_notify, GNUNET_YES, handlers);
652 stop_arm (struct PeerContext *p)
655 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
656 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
657 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
658 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
660 GNUNET_OS_process_get_pid (p->arm_proc));
661 GNUNET_OS_process_close (p->arm_proc);
664 GNUNET_CONFIGURATION_destroy (p->cfg);
672 char *const argv[] = { "test-core-quota-compliance",
674 "test_core_api_data.conf",
680 struct GNUNET_GETOPT_CommandLineOption options[] = {
681 GNUNET_GETOPT_OPTION_END
684 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
685 "test-core-quota-compliance", "nohelp", options, &run,
693 main (int argc, char *argv[])
698 if (strstr (argv[0], "_symmetric") != NULL)
702 else if (strstr (argv[0], "_asymmetric_send") != NULL)
704 test = ASYMMETRIC_SEND_LIMITED;
706 else if (strstr (argv[0], "_asymmetric_recv") != NULL)
708 test = ASYMMETRIC_RECV_LIMITED;
710 GNUNET_assert (test != -1);
711 if (test == SYMMETRIC)
713 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
714 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
716 else if (test == ASYMMETRIC_SEND_LIMITED)
718 GNUNET_DISK_directory_remove
719 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
720 GNUNET_DISK_directory_remove
721 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
723 else if (test == ASYMMETRIC_RECV_LIMITED)
725 GNUNET_DISK_directory_remove
726 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
727 GNUNET_DISK_directory_remove
728 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
731 GNUNET_log_setup ("test-core-quota-compliance",
739 if (test == SYMMETRIC)
741 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
742 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
744 else if (test == ASYMMETRIC_SEND_LIMITED)
746 GNUNET_DISK_directory_remove
747 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
748 GNUNET_DISK_directory_remove
749 ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
751 else if (test == ASYMMETRIC_RECV_LIMITED)
753 GNUNET_DISK_directory_remove
754 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
755 GNUNET_DISK_directory_remove
756 ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
764 /* end of test_core_api_reliability.c */