aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_communicator_basic.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-06-01 18:43:32 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-06-01 18:43:32 +0200
commit583bc67ba55e5827f11bc904a253fe65f4b99b43 (patch)
treecb2f10f8eb3a38eeb3a850dd3e1941aa959bb880 /src/transport/test_communicator_basic.c
parentd20be8a919b93cbfd1e1de3b41ca0fa370949b05 (diff)
downloadgnunet-583bc67ba55e5827f11bc904a253fe65f4b99b43.tar.gz
gnunet-583bc67ba55e5827f11bc904a253fe65f4b99b43.zip
tng: MTU fix for other UNIXes, log message
Diffstat (limited to 'src/transport/test_communicator_basic.c')
-rw-r--r--src/transport/test_communicator_basic.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index 26a10fb74..290167960 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -72,7 +72,7 @@ static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc;
72 72
73#define LONG_MESSAGE_SIZE 32000 /* FIXME */ 73#define LONG_MESSAGE_SIZE 32000 /* FIXME */
74 74
75#define BURST_PACKETS 500 75#define BURST_PACKETS 5000
76 76
77#define TOTAL_ITERATIONS 1 77#define TOTAL_ITERATIONS 1
78 78
@@ -185,7 +185,7 @@ handle_backchannel_cb (void *cls,
185 struct GNUNET_PeerIdentity *pid) 185 struct GNUNET_PeerIdentity *pid)
186{ 186{
187 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 187 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
188 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handling BC message...\n"); 188 LOG (GNUNET_ERROR_TYPE_DEBUG, "Handling BC message...\n");
189 if (0 == memcmp (&peer_id[PEER_A], pid, sizeof (*pid))) 189 if (0 == memcmp (&peer_id[PEER_A], pid, sizeof (*pid)))
190 return tc_hs[PEER_A]; 190 return tc_hs[PEER_A];
191 else 191 else
@@ -223,7 +223,7 @@ latency_timeout (void *cls)
223 return; 223 return;
224 } 224 }
225 225
226 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 226 LOG (GNUNET_ERROR_TYPE_ERROR,
227 "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n", 227 "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n",
228 phase, num_sent, num_received); 228 phase, num_sent, num_received);
229 ret = 2; 229 ret = 2;
@@ -352,7 +352,7 @@ add_queue_cb (void *cls,
352 start_short = GNUNET_TIME_absolute_get (); 352 start_short = GNUNET_TIME_absolute_get ();
353 my_tc = tc_h; 353 my_tc = tc_h;
354 if (0 != mtu) 354 if (0 != mtu)
355 long_message_size = mtu; 355 long_message_size = mtu - 4; /* Dummy message header overhead */
356 else 356 else
357 long_message_size = LONG_MESSAGE_SIZE; 357 long_message_size = LONG_MESSAGE_SIZE;
358 phase = TP_BURST_SHORT; 358 phase = TP_BURST_SHORT;
@@ -402,7 +402,7 @@ incoming_message_cb (void *cls,
402{ 402{
403 if (0 != strcmp ((char*) cls, cfg_peers_name[NUM_PEERS - 1])) 403 if (0 != strcmp ((char*) cls, cfg_peers_name[NUM_PEERS - 1]))
404 { 404 {
405 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 405 LOG (GNUNET_ERROR_TYPE_WARNING,
406 "unexpected receiver...\n"); 406 "unexpected receiver...\n");
407 return; 407 return;
408 } 408 }
@@ -421,13 +421,13 @@ incoming_message_cb (void *cls,
421 update_avg_latency (payload); 421 update_avg_latency (payload);
422 if (num_received == BURST_PACKETS) 422 if (num_received == BURST_PACKETS)
423 { 423 {
424 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 424 LOG (GNUNET_ERROR_TYPE_MESSAGE,
425 "Short size packet test done.\n"); 425 "Short size packet test done.\n");
426 char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE 426 char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE
427 * num_received * 1000 427 * num_received * 1000
428 * 1000) 428 * 1000)
429 / duration.rel_value_us); 429 / duration.rel_value_us);
430 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 430 LOG (GNUNET_ERROR_TYPE_MESSAGE,
431 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", 431 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
432 (unsigned long) num_received, 432 (unsigned long) num_received,
433 (unsigned long) num_sent, 433 (unsigned long) num_sent,
@@ -448,7 +448,7 @@ incoming_message_cb (void *cls,
448 { 448 {
449 if (long_message_size != payload_len) 449 if (long_message_size != payload_len)
450 { 450 {
451 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 451 LOG (GNUNET_ERROR_TYPE_WARNING,
452 "Ignoring packet with wrong length\n"); 452 "Ignoring packet with wrong length\n");
453 return; // Ignore 453 return; // Ignore
454 } 454 }
@@ -457,14 +457,14 @@ incoming_message_cb (void *cls,
457 update_avg_latency (payload); 457 update_avg_latency (payload);
458 if (num_received == BURST_PACKETS) 458 if (num_received == BURST_PACKETS)
459 { 459 {
460 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 460 LOG (GNUNET_ERROR_TYPE_MESSAGE,
461 "Long size packet test done.\n"); 461 "Long size packet test done.\n");
462 char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size 462 char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size
463 * num_received * 1000 463 * num_received * 1000
464 * 1000) 464 * 1000)
465 / duration.rel_value_us); 465 / duration.rel_value_us);
466 466
467 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 467 LOG (GNUNET_ERROR_TYPE_MESSAGE,
468 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", 468 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
469 (unsigned long) num_received, 469 (unsigned long) num_received,
470 (unsigned long) num_sent, 470 (unsigned long) num_sent,
@@ -492,9 +492,9 @@ incoming_message_cb (void *cls,
492 update_avg_latency (payload); 492 update_avg_latency (payload);
493 if (num_received >= (max_size) / 10) 493 if (num_received >= (max_size) / 10)
494 { 494 {
495 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 495 LOG (GNUNET_ERROR_TYPE_MESSAGE,
496 "Size packet test done.\n"); 496 "Size packet test done.\n");
497 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 497 LOG (GNUNET_ERROR_TYPE_MESSAGE,
498 "%lu/%lu packets -- avg latency: %llu us\n", 498 "%lu/%lu packets -- avg latency: %llu us\n",
499 (unsigned long) num_received, 499 (unsigned long) num_received,
500 (unsigned long) num_sent, 500 (unsigned long) num_sent,
@@ -510,7 +510,7 @@ incoming_message_cb (void *cls,
510 short_test (NULL); 510 short_test (NULL);
511 break; 511 break;
512 } 512 }
513 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 513 LOG (GNUNET_ERROR_TYPE_DEBUG,
514 "Finished\n"); 514 "Finished\n");
515 GNUNET_SCHEDULER_shutdown (); 515 GNUNET_SCHEDULER_shutdown ();
516 } 516 }
@@ -639,12 +639,12 @@ main (int argc,
639 GNUNET_CRYPTO_eddsa_key_get_public (private_key, 639 GNUNET_CRYPTO_eddsa_key_get_public (private_key,
640 &peer_id[i].public_key); 640 &peer_id[i].public_key);
641 GNUNET_free (private_key); 641 GNUNET_free (private_key);
642 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 642 LOG (GNUNET_ERROR_TYPE_INFO,
643 "Identity of peer %u is %s\n", 643 "Identity of peer %u is %s\n",
644 i, 644 i,
645 GNUNET_i2s_full (&peer_id[i])); 645 GNUNET_i2s_full (&peer_id[i]));
646 } 646 }
647 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n"); 647 LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n");
648 GNUNET_SCHEDULER_run (&run, 648 GNUNET_SCHEDULER_run (&run,
649 NULL); 649 NULL);
650 return ret; 650 return ret;