aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-22 23:25:25 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-22 23:25:25 +0100
commit22141e7eb07d6331ad1c2548032c2de014f33383 (patch)
tree7235a0e6bb5e09842bd867e022f87cd363e03d4b /src/cadet/test_cadet.c
parent69a00f58f5fb67e57dcfb5de753680dca9f004e3 (diff)
downloadgnunet-22141e7eb07d6331ad1c2548032c2de014f33383.tar.gz
gnunet-22141e7eb07d6331ad1c2548032c2de014f33383.zip
simplify check_data logic
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r--src/cadet/test_cadet.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index a411b41bc..b19963bba 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -536,7 +536,9 @@ tmt_rdy (void *cls, size_t size, void *buf)
536 long id = (long) cls; 536 long id = (long) cls;
537 unsigned int counter; 537 unsigned int counter;
538 538
539 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy on %ld, filling buffer\n", id); 539 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
540 "tmt_rdy on %ld, filling buffer\n",
541 id);
540 if (0 == id) 542 if (0 == id)
541 th = NULL; 543 th = NULL;
542 else if ((peers_requested - 1) == id) 544 else if ((peers_requested - 1) == id)
@@ -545,7 +547,8 @@ tmt_rdy (void *cls, size_t size, void *buf)
545 GNUNET_assert (0); 547 GNUNET_assert (0);
546 counter = get_expected_target () == id ? ack_sent : data_sent; 548 counter = get_expected_target () == id ? ack_sent : data_sent;
547 msg_size = size_payload + counter; 549 msg_size = size_payload + counter;
548 if (size < msg_size || NULL == buf) 550 if ( (size < msg_size) ||
551 (NULL == buf) )
549 { 552 {
550 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
551 "size %u, buf %p, data_sent %u, ack_received %u\n", 554 "size %u, buf %p, data_sent %u, ack_received %u\n",
@@ -569,7 +572,8 @@ tmt_rdy (void *cls, size_t size, void *buf)
569 if (SPEED_ACK == test) 572 if (SPEED_ACK == test)
570 data_sent++; 573 data_sent++;
571 } 574 }
572 else if (SPEED == test || SPEED_ACK == test) 575 else if ( (SPEED == test) ||
576 (SPEED_ACK == test) )
573 { 577 {
574 if (get_expected_target() == id) 578 if (get_expected_target() == id)
575 ack_sent++; 579 ack_sent++;
@@ -580,9 +584,11 @@ tmt_rdy (void *cls, size_t size, void *buf)
580 " Sent message %u size %u\n", 584 " Sent message %u size %u\n",
581 counter, 585 counter,
582 (unsigned int) msg_size); 586 (unsigned int) msg_size);
583 if (data_sent < TOTAL_PACKETS && SPEED == test) 587 if ( (data_sent < TOTAL_PACKETS) &&
588 (SPEED == test) )
584 { 589 {
585 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Scheduling message %d\n", 590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
591 " Scheduling message %d\n",
586 counter + 1); 592 counter + 1);
587 data_job = GNUNET_SCHEDULER_add_now (&data_task, NULL); 593 data_job = GNUNET_SCHEDULER_add_now (&data_task, NULL);
588 } 594 }