#define VERBOSE GNUNET_YES
#define START_ARM GNUNET_YES
-#define DEBUG_CONNECTIONS GNUNET_YES
+#define DEBUG_CONNECTIONS GNUNET_NO
/**
* Note that this value must not significantly exceed
static int is_asymmetric_send_constant;
static int is_asymmetric_recv_constant;
-static unsigned long long current_quota_p1;
-static unsigned long long current_quota_p2;
+static unsigned long long current_quota_p1_in;
+static unsigned long long current_quota_p1_out;
+static unsigned long long current_quota_p2_in;
+static unsigned long long current_quota_p2_out;
static unsigned long long total_bytes;
static unsigned long long total_bytes_sent;
struct PeerContext *pc = cls;
GNUNET_assert (pc->connect_status == 0);
pc->connect_status = 1;
+#if DEBUG_CONNECTIONS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Encrypted connection established to peer `%4s'\n",
GNUNET_i2s (peer));
+#endif
}
{
struct PeerContext *pc = cls;
pc->connect_status = 0;
+#if DEBUG_CONNECTIONS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Encrypted connection to `%4s' cut\n", GNUNET_i2s (peer));
+#endif
}
measurement_running = GNUNET_NO;
duration = GNUNET_TIME_absolute_get_difference(start_time, GNUNET_TIME_absolute_get());
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TIMEOUT\n");
-
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"\nQuota compliance: \n"\
- "Throughput : %10llu kB/s\n", (total_bytes_sent/(duration.rel_value / 1000)/1024));
+ "Throughput : %10llu kB/s\n"\
+ "Quota : %10llu kB/s\n", (total_bytes_sent/(duration.rel_value / 1000)/1024),current_quota_p1_in/1024);
if (err_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (sched, err_task);
static void measure (unsigned long long quota_p1, unsigned long long quota_p2 )
{
-
- current_quota_p1 = quota_p1;
- current_quota_p2 = quota_p2;
#if VERBOSE
if ((is_asymmetric_send_constant == GNUNET_YES) || (is_asymmetric_recv_constant == GNUNET_YES))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting core level measurement for %u seconds, receiving peer quota %llu kB/s, sending peer quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1 / 1024, current_quota_p2 / 1024);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Starting core level measurement for %u seconds, receiving peer quota %llu kB/s, sending peer quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p1_in / 1024, current_quota_p2_out / 1024);
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting core level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2 / 1024);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Starting core level measurement for %u seconds, symmetric quota %llu kB/s\n", MEASUREMENT_INTERVALL.rel_value / 1000 , current_quota_p2_out / 1024);
#endif
-
- GNUNET_TRANSPORT_set_quota (p1.th,
- &p2.id,
- GNUNET_BANDWIDTH_value_init (current_quota_p1 ),
- GNUNET_BANDWIDTH_value_init (current_quota_p1 ),
- GNUNET_TIME_UNIT_FOREVER_REL,
- NULL, NULL);
- GNUNET_TRANSPORT_set_quota (p2.th,
- &p1.id,
- GNUNET_BANDWIDTH_value_init (current_quota_p2),
- GNUNET_BANDWIDTH_value_init (current_quota_p2),
- GNUNET_TIME_UNIT_FOREVER_REL,
- NULL, NULL);
-
+#if DEBUG_CONNECTIONS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking core (1) for transmission to peer `%4s'\n",
GNUNET_i2s (&p2.id));
+#endif
err_task = GNUNET_SCHEDULER_add_delayed (sched,
TIMEOUT,
&terminate_task_error,
0,
FAST_TIMEOUT,
&p2.id,
- sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
+ sizeof (struct TestMessage) + MEASUREMENT_MSG_SIZE,
&transmit_ready, &p1);
return ret;
}
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
{
struct PeerContext *p = cls;
-
+#if DEBUG_CONNECTIONS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Connection to CORE service of `%4s' established\n",
GNUNET_i2s (my_identity));
+#endif
GNUNET_assert (server != NULL);
p->id = *my_identity;
p->ch = server;
struct PeerContext *p = cls;
GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p);
+#if DEBUG_CONNECTIONS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received (my) `%s' from transport service\n",
"HELLO");
+#endif
GNUNET_assert (message != NULL);
p->hello = GNUNET_malloc (ntohs (message->size));
memcpy (p->hello, message, ntohs (message->size));
GNUNET_assert (ok == 1);
OKPP;
sched = s;
- setup_peer (&p1, "test_core_api_peer1.conf");
- setup_peer (&p2, "test_core_api_peer2.conf");
+ setup_peer (&p1, "test_core_quota_peer1.conf");
+ setup_peer (&p2, "test_core_quota_peer2.conf");
GNUNET_CORE_connect (sched,
p1.cfg,
TIMEOUT,
&p1,
&init_notify,
- &connect_notify,
+ &connect_notify,
&disconnect_notify,
- NULL,
+ NULL,
&inbound_notify,
GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
+
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p1.cfg,
+ "CORE",
+ "TOTAL_QUOTA_IN",
+ ¤t_quota_p1_in));
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p2.cfg,
+ "CORE",
+ "TOTAL_QUOTA_IN",
+ ¤t_quota_p2_in));
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p1.cfg,
+ "CORE",
+ "TOTAL_QUOTA_OUT",
+ ¤t_quota_p1_out));
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_number (p2.cfg,
+ "CORE",
+ "TOTAL_QUOTA_OUT",
+ ¤t_quota_p2_out));
}
static int
check ()
{
- char *const argv[] = { "test-core-api-reliability",
+ char *const argv[] = { "test-core-quota-compliance",
"-c",
"test_core_api_data.conf",
#if VERBOSE
#endif
NULL);
ret = check ();
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
- GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
+ GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-peer-2");
+ GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-peer-2");
return ret;
}