diff options
author | Bart Polot <bart@net.in.tum.de> | 2016-07-20 12:07:05 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2016-07-20 12:07:05 +0000 |
commit | dbb12b0c0216846ec0cfa30ed2760c221434eaee (patch) | |
tree | 140b649ad916e45f17faa42a5ba5cdf3563b2e52 /src/cadet/test_cadet.c | |
parent | caa4196867da8684c5b1fd2e747ecb9d21cbba8b (diff) | |
download | gnunet-dbb12b0c0216846ec0cfa30ed2760c221434eaee.tar.gz gnunet-dbb12b0c0216846ec0cfa30ed2760c221434eaee.zip |
- adapt test cases / framework to new port system
Diffstat (limited to 'src/cadet/test_cadet.c')
-rw-r--r-- | src/cadet/test_cadet.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index 557524ca3..e2d3902e5 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -97,6 +97,11 @@ struct GNUNET_TESTBED_Operation *t_op[2]; | |||
97 | struct GNUNET_PeerIdentity *p_id[2]; | 97 | struct GNUNET_PeerIdentity *p_id[2]; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Port ID | ||
101 | */ | ||
102 | struct GNUNET_HashCode port; | ||
103 | |||
104 | /** | ||
100 | * Peer ids counter. | 105 | * Peer ids counter. |
101 | */ | 106 | */ |
102 | unsigned int p_ids; | 107 | unsigned int p_ids; |
@@ -761,12 +766,13 @@ static struct GNUNET_CADET_MessageHandler handlers[] = { | |||
761 | static void * | 766 | static void * |
762 | incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, | 767 | incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, |
763 | const struct GNUNET_PeerIdentity *initiator, | 768 | const struct GNUNET_PeerIdentity *initiator, |
764 | uint32_t port, enum GNUNET_CADET_ChannelOption options) | 769 | const struct GNUNET_HashCode *port, |
770 | enum GNUNET_CADET_ChannelOption options) | ||
765 | { | 771 | { |
766 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 772 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
767 | "Incoming channel from %s to peer %d\n", | 773 | "Incoming channel from %s to peer %d:%s\n", |
768 | GNUNET_i2s (initiator), | 774 | GNUNET_i2s (initiator), |
769 | (int) (long) cls); | 775 | (int) (long) cls, GNUNET_h2s (port)); |
770 | ok++; | 776 | ok++; |
771 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); | 777 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok); |
772 | if ((long) cls == peers_requested - 1) | 778 | if ((long) cls == peers_requested - 1) |
@@ -865,7 +871,8 @@ do_test (void *cls) | |||
865 | test = SPEED; | 871 | test = SPEED; |
866 | flags |= GNUNET_CADET_OPTION_RELIABLE; | 872 | flags |= GNUNET_CADET_OPTION_RELIABLE; |
867 | } | 873 | } |
868 | ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags); | 874 | |
875 | ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], &port, flags); | ||
869 | 876 | ||
870 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, | 877 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, |
871 | &gather_stats_and_exit, | 878 | &gather_stats_and_exit, |
@@ -965,8 +972,10 @@ int | |||
965 | main (int argc, char *argv[]) | 972 | main (int argc, char *argv[]) |
966 | { | 973 | { |
967 | initialized = GNUNET_NO; | 974 | initialized = GNUNET_NO; |
968 | static uint32_t ports[2]; | 975 | static const struct GNUNET_HashCode *ports[2]; |
969 | const char *config_file; | 976 | const char *config_file; |
977 | char port_id[] = "test port"; | ||
978 | GNUNET_CRYPTO_hash (port_id, sizeof (port_id), &port); | ||
970 | 979 | ||
971 | GNUNET_log_setup ("test", "DEBUG", NULL); | 980 | GNUNET_log_setup ("test", "DEBUG", NULL); |
972 | config_file = "test_cadet.conf"; | 981 | config_file = "test_cadet.conf"; |
@@ -1066,8 +1075,8 @@ main (int argc, char *argv[]) | |||
1066 | } | 1075 | } |
1067 | 1076 | ||
1068 | p_ids = 0; | 1077 | p_ids = 0; |
1069 | ports[0] = 1; | 1078 | ports[0] = &port; |
1070 | ports[1] = 0; | 1079 | ports[1] = NULL; |
1071 | GNUNET_CADET_TEST_run ("test_cadet_small", | 1080 | GNUNET_CADET_TEST_run ("test_cadet_small", |
1072 | config_file, | 1081 | config_file, |
1073 | peers_requested, | 1082 | peers_requested, |