aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_communicator_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_communicator_basic.c')
-rw-r--r--src/transport/test_communicator_basic.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index 14d1a4792..fdbad0957 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -104,13 +104,13 @@ static unsigned int iterations_left[NUM_PEERS];
104#define TIMEOUT_MULTIPLIER 1 104#define TIMEOUT_MULTIPLIER 1
105 105
106#define DELAY \ 106#define DELAY \
107 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200) 107 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200)
108 108
109#define SHORT_BURST_WINDOW \ 109#define SHORT_BURST_WINDOW \
110 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) 110 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2)
111 111
112#define LONG_BURST_WINDOW \ 112#define LONG_BURST_WINDOW \
113 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) 113 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2)
114 114
115enum TestPhase 115enum TestPhase
116{ 116{
@@ -394,7 +394,8 @@ process_statistics (void *cls,
394 { 394 {
395 ret = 2; 395 ret = 2;
396 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 396 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
397 "Not enough BOX messages!\n"); 397 "Not enough BOX messages! (want: %u, have %llu)\n",
398 9000, value);
398 GNUNET_SCHEDULER_shutdown (); 399 GNUNET_SCHEDULER_shutdown ();
399 } 400 }
400 if ((0 == strcmp ("rekey", test_name)) && 401 if ((0 == strcmp ("rekey", test_name)) &&
@@ -405,7 +406,8 @@ process_statistics (void *cls,
405 { 406 {
406 ret = 2; 407 ret = 2;
407 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 408 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
408 "Not enough BOX messages!\n"); 409 "Not enough BOX messages! (want: %u, have %llu)\n",
410 6000, value);
409 GNUNET_SCHEDULER_shutdown (); 411 GNUNET_SCHEDULER_shutdown ();
410 } 412 }
411 return GNUNET_OK; 413 return GNUNET_OK;
@@ -432,11 +434,13 @@ short_test_cb (void *cls)
432 tc_h); 434 tc_h);
433 payload = make_payload (SHORT_MESSAGE_SIZE); 435 payload = make_payload (SHORT_MESSAGE_SIZE);
434 num_sent_short[peer_nr]++; 436 num_sent_short[peer_nr]++;
437 if (burst_packets_short == num_sent_short[peer_nr])
438 tc_h->cont = NULL;
439 else
440 tc_h->cont = short_test;
441 tc_h->cont_cls = cls;
435 GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, 442 GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h,
436 (burst_packets_short == 443 NULL,
437 num_sent_short[peer_nr])
438 ? NULL
439 : &short_test,
440 cls, 444 cls,
441 payload, 445 payload,
442 SHORT_MESSAGE_SIZE); 446 SHORT_MESSAGE_SIZE);
@@ -477,11 +481,13 @@ size_test (void *cls)
477 ack[peer_nr] += 10; 481 ack[peer_nr] += 10;
478 payload = make_payload (ack[peer_nr]); 482 payload = make_payload (ack[peer_nr]);
479 num_sent_size[peer_nr]++; 483 num_sent_size[peer_nr]++;
484 if (ack[peer_nr] >= max_size)
485 tc_h->cont = NULL;
486 else
487 tc_h->cont = size_test;
488 tc_h->cont_cls = cls;
480 GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, 489 GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h,
481 (ack[peer_nr] < 490 NULL,
482 max_size)
483 ? &size_test
484 : NULL,
485 cls, 491 cls,
486 payload, 492 payload,
487 ack[peer_nr]); 493 ack[peer_nr]);
@@ -511,11 +517,13 @@ long_test_cb (void *cls)
511 (unsigned int) num_received_long[peer_nr]); 517 (unsigned int) num_received_long[peer_nr]);
512 payload = make_payload (long_message_size); 518 payload = make_payload (long_message_size);
513 num_sent_long[peer_nr]++; 519 num_sent_long[peer_nr]++;
520 if (burst_packets_long == num_sent_long[peer_nr])
521 tc_h->cont = NULL;
522 else
523 tc_h->cont = long_test;
524 tc_h->cont_cls = cls;
514 GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, 525 GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h,
515 (burst_packets_long == 526 NULL,
516 num_sent_long[peer_nr])
517 ? NULL
518 : &long_test,
519 cls, 527 cls,
520 payload, 528 payload,
521 long_message_size); 529 long_message_size);
@@ -784,7 +792,7 @@ add_queue_cb (void *cls,
784 return; 792 return;
785 LOG (GNUNET_ERROR_TYPE_DEBUG, 793 LOG (GNUNET_ERROR_TYPE_DEBUG,
786 "Queue established, starting test...\n"); 794 "Queue established, starting test...\n");
787 if (UINT32_MAX != mtu) /* Message header overhead */ 795 if (UINT16_MAX != mtu) /* Message header overhead */
788 long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo) 796 long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo)
789 - sizeof(struct GNUNET_MessageHeader); 797 - sizeof(struct GNUNET_MessageHeader);
790 else 798 else
@@ -935,7 +943,8 @@ incoming_message_cb (
935 if (long_message_size != payload_len) 943 if (long_message_size != payload_len)
936 { 944 {
937 LOG (GNUNET_ERROR_TYPE_WARNING, 945 LOG (GNUNET_ERROR_TYPE_WARNING,
938 "Ignoring packet with wrong length\n"); 946 "Ignoring packet with wrong length (have: %lu, want: %lu)\n",
947 payload_len, long_message_size);
939 return; // Ignore 948 return; // Ignore
940 } 949 }
941 num_received_long[peer_nr]++; 950 num_received_long[peer_nr]++;
@@ -1086,7 +1095,7 @@ main (int argc,
1086 phase[0] = TP_INIT; 1095 phase[0] = TP_INIT;
1087 phase[1] = TP_INIT; 1096 phase[1] = TP_INIT;
1088 ret = 1; 1097 ret = 1;
1089 test_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); 1098 test_name = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]);
1090 communicator_name = strchr (test_name, '-'); 1099 communicator_name = strchr (test_name, '-');
1091 communicator_name[0] = '\0'; 1100 communicator_name[0] = '\0';
1092 communicator_name++; 1101 communicator_name++;