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.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index 1ea79fa19..26a10fb74 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -200,6 +200,8 @@ make_payload (size_t payload_size)
200 struct GNUNET_TIME_AbsoluteNBO ts_n; 200 struct GNUNET_TIME_AbsoluteNBO ts_n;
201 char *payload = GNUNET_malloc (payload_size); 201 char *payload = GNUNET_malloc (payload_size);
202 202
203 LOG (GNUNET_ERROR_TYPE_DEBUG,
204 "Making payload of size %lu\n", payload_size);
203 GNUNET_assert (payload_size >= 8); // So that out timestamp fits 205 GNUNET_assert (payload_size >= 8); // So that out timestamp fits
204 ts = GNUNET_TIME_absolute_get (); 206 ts = GNUNET_TIME_absolute_get ();
205 ts_n = GNUNET_TIME_absolute_hton (ts); 207 ts_n = GNUNET_TIME_absolute_hton (ts);
@@ -238,10 +240,10 @@ size_test (void *cls)
238 GNUNET_assert (TP_SIZE_CHECK == phase); 240 GNUNET_assert (TP_SIZE_CHECK == phase);
239 if (LONG_MESSAGE_SIZE != long_message_size) 241 if (LONG_MESSAGE_SIZE != long_message_size)
240 max_size = long_message_size; 242 max_size = long_message_size;
241 if (ack >= max_size) 243 if (ack + 10 > max_size)
242 return; /* Leave some room for our protocol, so not 2^16 exactly */ 244 return; /* Leave some room for our protocol, so not 2^16 exactly */
245 ack += 10;
243 payload = make_payload (ack); 246 payload = make_payload (ack);
244 ack += 5;
245 num_sent++; 247 num_sent++;
246 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 248 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
247 (ack < max_size) 249 (ack < max_size)
@@ -470,7 +472,7 @@ incoming_message_cb (void *cls,
470 goodput, 472 goodput,
471 (unsigned long long) avg_latency); 473 (unsigned long long) avg_latency);
472 GNUNET_free (goodput); 474 GNUNET_free (goodput);
473 ack = 10; 475 ack = 0;
474 phase = TP_SIZE_CHECK; 476 phase = TP_SIZE_CHECK;
475 num_received = 0; 477 num_received = 0;
476 num_sent = 0; 478 num_sent = 0;
@@ -481,9 +483,14 @@ incoming_message_cb (void *cls,
481 } 483 }
482 case TP_SIZE_CHECK: 484 case TP_SIZE_CHECK:
483 { 485 {
486 size_t max_size = 64000;
487
488 GNUNET_assert (TP_SIZE_CHECK == phase);
489 if (LONG_MESSAGE_SIZE != long_message_size)
490 max_size = long_message_size;
484 num_received++; 491 num_received++;
485 update_avg_latency (payload); 492 update_avg_latency (payload);
486 if (num_received >= (64000 - 10) / 5) 493 if (num_received >= (max_size) / 10)
487 { 494 {
488 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 495 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
489 "Size packet test done.\n"); 496 "Size packet test done.\n");