aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-22 23:23:20 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-22 23:23:20 +0200
commit9be8a466ac6627c30ffc827d459e02a67cdaf929 (patch)
tree0708b264839840ea56cdf733bb7c6695fbf46101 /src/cadet/test_cadet.c
parentea5fa09f7b19bf2fbde52eab8a72e921d87068aa (diff)
downloadgnunet-9be8a466ac6627c30ffc827d459e02a67cdaf929.tar.gz
gnunet-9be8a466ac6627c30ffc827d459e02a67cdaf929.zip
fix indentation
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r--src/cadet/test_cadet.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index b9f177652..608136e56 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -402,8 +402,11 @@ stats_cont (void *cls,
402 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration 402 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
403 */ 403 */
404static int 404static int
405stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer, 405stats_iterator (void *cls,
406 const char *subsystem, const char *name, uint64_t value, 406 const struct GNUNET_TESTBED_Peer *peer,
407 const char *subsystem,
408 const char *name,
409 uint64_t value,
407 int is_persistent) 410 int is_persistent)
408{ 411{
409 static const char *s_sent = "# keepalives sent"; 412 static const char *s_sent = "# keepalives sent";
@@ -614,10 +617,9 @@ reschedule_timeout_task (long line)
614 * #GNUNET_SYSERR to close it (signal serious error). 617 * #GNUNET_SYSERR to close it (signal serious error).
615 */ 618 */
616static int 619static int
617check_data (void *cls, const struct GNUNET_MessageHeader *message) 620check_data (void *cls,
621 const struct GNUNET_MessageHeader *message)
618{ 622{
619 if (sizeof (struct GNUNET_MessageHeader) >= ntohs (message->size))
620 return GNUNET_SYSERR;
621 return GNUNET_OK; /* all is well-formed */ 623 return GNUNET_OK; /* all is well-formed */
622} 624}
623 625
@@ -646,24 +648,33 @@ handle_data (void *cls,
646 648
647 if (channel == outgoing_ch) 649 if (channel == outgoing_ch)
648 { 650 {
649 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Root client got a message.\n"); 651 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
652 "Root client got a message.\n");
650 } 653 }
651 else if (channel == incoming_ch) 654 else if (channel == incoming_ch)
652 { 655 {
653 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Leaf client got a message.\n"); 656 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
657 "Leaf client got a message.\n");
654 } 658 }
655 else 659 else
656 { 660 {
657 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unknown channel %p.\n", channel); 661 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
662 "Unknown channel %p.\n",
663 channel);
658 GNUNET_assert (0); 664 GNUNET_assert (0);
659 } 665 }
660 666
661 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal); 667 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
668 " ok: (%d/%d)\n",
669 ok,
670 ok_goal);
662 data = (uint32_t *) &message[1]; 671 data = (uint32_t *) &message[1];
663 payload = ntohl (*data); 672 payload = ntohl (*data);
664 if (payload == *counter) 673 if (payload == *counter)
665 { 674 {
666 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " payload as expected: %u\n", payload); 675 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
676 " payload as expected: %u\n",
677 payload);
667 } 678 }
668 else 679 else
669 { 680 {
@@ -679,7 +690,8 @@ handle_data (void *cls,
679 if (SPEED == test) 690 if (SPEED == test)
680 { 691 {
681 GNUNET_assert (incoming_ch == channel); 692 GNUNET_assert (incoming_ch == channel);
682 send_next_msg_task = GNUNET_SCHEDULER_add_now (&send_next_msg, NULL); 693 send_next_msg_task = GNUNET_SCHEDULER_add_now (&send_next_msg,
694 NULL);
683 return; 695 return;
684 } 696 }
685 } 697 }
@@ -740,7 +752,8 @@ handle_data (void *cls,
740 * received on the @a channel. 752 * received on the @a channel.
741 */ 753 */
742static void * 754static void *
743connect_handler (void *cls, struct GNUNET_CADET_Channel *channel, 755connect_handler (void *cls,
756 struct GNUNET_CADET_Channel *channel,
744 const struct GNUNET_PeerIdentity *source) 757 const struct GNUNET_PeerIdentity *source)
745{ 758{
746 struct CadetTestChannelWrapper *ch; 759 struct CadetTestChannelWrapper *ch;
@@ -748,15 +761,20 @@ connect_handler (void *cls, struct GNUNET_CADET_Channel *channel,
748 761
749 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 762 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
750 "Incoming channel from %s to %ld: %p\n", 763 "Incoming channel from %s to %ld: %p\n",
751 GNUNET_i2s (source), peer, channel); 764 GNUNET_i2s (source),
765 peer,
766 channel);
752 ok++; 767 ok++;
753 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); 768 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
769 " ok: %d\n",
770 ok);
754 if (peer == peers_requested - 1) 771 if (peer == peers_requested - 1)
755 { 772 {
756 if (NULL != incoming_ch) 773 if (NULL != incoming_ch)
757 { 774 {
758 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 775 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
759 "Duplicate incoming channel for client %lu\n", (long) cls); 776 "Duplicate incoming channel for client %lu\n",
777 (long) cls);
760 GNUNET_assert (0); 778 GNUNET_assert (0);
761 } 779 }
762 incoming_ch = channel; 780 incoming_ch = channel;
@@ -764,7 +782,8 @@ connect_handler (void *cls, struct GNUNET_CADET_Channel *channel,
764 else 782 else
765 { 783 {
766 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 784 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
767 "Incoming channel for unexpected peer #%lu\n", (long) cls); 785 "Incoming channel for unexpected peer #%lu\n",
786 (long) cls);
768 GNUNET_assert (0); 787 GNUNET_assert (0);
769 } 788 }
770 if (NULL != disconnect_task) 789 if (NULL != disconnect_task)
@@ -1003,7 +1022,6 @@ main (int argc, char *argv[])
1003 "short_time", 1022 "short_time",
1004 gettext_noop ("set short timeout"), 1023 gettext_noop ("set short timeout"),
1005 &short_time), 1024 &short_time),
1006
1007 GNUNET_GETOPT_option_uint ('m', 1025 GNUNET_GETOPT_option_uint ('m',
1008 "messages", 1026 "messages",
1009 "NUM_MESSAGES", 1027 "NUM_MESSAGES",