diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-22 14:20:16 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-22 14:20:16 +0100 |
commit | c79a9a5adc5e141bf9142323c48ce552cc90a079 (patch) | |
tree | e830c0a1ce8ced93ad9da657f5ddd968c3b03c17 /src/cadet/test_cadet.c | |
parent | 2df6a5610eca0fbf9dd953cf42fccf35da9b1231 (diff) | |
download | gnunet-c79a9a5adc5e141bf9142323c48ce552cc90a079.tar.gz gnunet-c79a9a5adc5e141bf9142323c48ce552cc90a079.zip |
fix indentation
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r-- | src/cadet/test_cadet.c | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index cf18b8a90..db19db4ed 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -599,11 +599,12 @@ tmt_rdy (void *cls, size_t size, void *buf) | |||
599 | * @param channel connection to the other end | 599 | * @param channel connection to the other end |
600 | * @param channel_ctx place to store local state associated with the channel | 600 | * @param channel_ctx place to store local state associated with the channel |
601 | * @param message the actual message | 601 | * @param message the actual message |
602 | * @return GNUNET_OK to keep the connection open, | 602 | * @return #GNUNET_OK to keep the connection open, |
603 | * GNUNET_SYSERR to close it (signal serious error) | 603 | * #GNUNET_SYSERR to close it (signal serious error) |
604 | */ | 604 | */ |
605 | int | 605 | static int |
606 | data_callback (void *cls, struct GNUNET_CADET_Channel *channel, | 606 | data_callback (void *cls, |
607 | struct GNUNET_CADET_Channel *channel, | ||
607 | void **channel_ctx, | 608 | void **channel_ctx, |
608 | const struct GNUNET_MessageHeader *message) | 609 | const struct GNUNET_MessageHeader *message) |
609 | { | 610 | { |
@@ -764,10 +765,11 @@ static struct GNUNET_CADET_MessageHandler handlers[] = { | |||
764 | * (can be NULL -- that's not an error). | 765 | * (can be NULL -- that's not an error). |
765 | */ | 766 | */ |
766 | static void * | 767 | static void * |
767 | incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, | 768 | incoming_channel (void *cls, |
768 | const struct GNUNET_PeerIdentity *initiator, | 769 | struct GNUNET_CADET_Channel *channel, |
769 | const struct GNUNET_HashCode *port, | 770 | const struct GNUNET_PeerIdentity *initiator, |
770 | enum GNUNET_CADET_ChannelOption options) | 771 | const struct GNUNET_HashCode *port, |
772 | enum GNUNET_CADET_ChannelOption options) | ||
771 | { | 773 | { |
772 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 774 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
773 | "Incoming channel from %s to peer %d:%s\n", | 775 | "Incoming channel from %s to peer %d:%s\n", |
@@ -804,7 +806,8 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, | |||
804 | * with the channel is stored | 806 | * with the channel is stored |
805 | */ | 807 | */ |
806 | static void | 808 | static void |
807 | channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel, | 809 | channel_cleaner (void *cls, |
810 | const struct GNUNET_CADET_Channel *channel, | ||
808 | void *channel_ctx) | 811 | void *channel_ctx) |
809 | { | 812 | { |
810 | long i = (long) cls; | 813 | long i = (long) cls; |
@@ -857,8 +860,8 @@ do_test (void *cls) | |||
857 | enum GNUNET_CADET_ChannelOption flags; | 860 | enum GNUNET_CADET_ChannelOption flags; |
858 | 861 | ||
859 | test_task = NULL; | 862 | test_task = NULL; |
860 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "do_test\n"); | 863 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
861 | 864 | "do_test\n"); | |
862 | if (NULL != disconnect_task) | 865 | if (NULL != disconnect_task) |
863 | { | 866 | { |
864 | GNUNET_SCHEDULER_cancel (disconnect_task); | 867 | GNUNET_SCHEDULER_cancel (disconnect_task); |
@@ -872,20 +875,27 @@ do_test (void *cls) | |||
872 | flags |= GNUNET_CADET_OPTION_RELIABLE; | 875 | flags |= GNUNET_CADET_OPTION_RELIABLE; |
873 | } | 876 | } |
874 | 877 | ||
875 | ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], &port, flags); | 878 | ch = GNUNET_CADET_channel_create (h1, |
879 | NULL, | ||
880 | p_id[1], | ||
881 | &port, | ||
882 | flags); | ||
876 | 883 | ||
877 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, | 884 | disconnect_task |
878 | &gather_stats_and_exit, | 885 | = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, |
879 | (void *) __LINE__); | 886 | &gather_stats_and_exit, |
887 | (void *) __LINE__); | ||
880 | if (KEEPALIVE == test) | 888 | if (KEEPALIVE == test) |
881 | return; /* Don't send any data. */ | 889 | return; /* Don't send any data. */ |
882 | 890 | ||
883 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending data initializer...\n"); | 891 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
892 | "Sending data initializer...\n"); | ||
884 | data_received = 0; | 893 | data_received = 0; |
885 | data_sent = 0; | 894 | data_sent = 0; |
886 | ack_received = 0; | 895 | ack_received = 0; |
887 | ack_sent = 0; | 896 | ack_sent = 0; |
888 | th = GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO, | 897 | th = GNUNET_CADET_notify_transmit_ready (ch, |
898 | GNUNET_NO, | ||
889 | GNUNET_TIME_UNIT_FOREVER_REL, | 899 | GNUNET_TIME_UNIT_FOREVER_REL, |
890 | size_payload + 1000, | 900 | size_payload + 1000, |
891 | &tmt_rdy, (void *) 0L); | 901 | &tmt_rdy, (void *) 0L); |
@@ -909,24 +919,31 @@ pi_cb (void *cls, | |||
909 | { | 919 | { |
910 | long i = (long) cls; | 920 | long i = (long) cls; |
911 | 921 | ||
912 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "id callback for %ld\n", i); | 922 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
923 | "id callback for %ld\n", i); | ||
913 | 924 | ||
914 | if (NULL == pinfo || NULL != emsg) | 925 | if ( (NULL == pinfo) || |
926 | (NULL != emsg) ) | ||
915 | { | 927 | { |
916 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "pi_cb: %s\n", emsg); | 928 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
929 | "pi_cb: %s\n", emsg); | ||
917 | abort_test (__LINE__); | 930 | abort_test (__LINE__); |
918 | return; | 931 | return; |
919 | } | 932 | } |
920 | p_id[i] = pinfo->result.id; | 933 | p_id[i] = pinfo->result.id; |
921 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id: %s\n", GNUNET_i2s (p_id[i])); | 934 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
935 | " id: %s\n", GNUNET_i2s (p_id[i])); | ||
922 | p_ids++; | 936 | p_ids++; |
923 | if (p_ids < 2) | 937 | if (p_ids < 2) |
924 | return; | 938 | return; |
925 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got all IDs, starting test\n"); | 939 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
940 | "Got all IDs, starting test\n"); | ||
926 | test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 941 | test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
927 | &do_test, NULL); | 942 | &do_test, |
943 | NULL); | ||
928 | } | 944 | } |
929 | 945 | ||
946 | |||
930 | /** | 947 | /** |
931 | * test main: start test when all peers are connected | 948 | * test main: start test when all peers are connected |
932 | * | 949 | * |