diff options
author | xrs <xrs@mail36.net> | 2020-03-05 09:32:49 +0100 |
---|---|---|
committer | xrs <xrs@mail36.net> | 2020-05-21 22:46:49 +0200 |
commit | 81405b6abff2f0b6fb774bdf227ded577c1ce2de (patch) | |
tree | df18967091547bb3af7ddbf712764e7ea3741282 | |
parent | f5da9cfbe9afaa471272127b61d6e17982209d03 (diff) | |
download | gnunet-81405b6abff2f0b6fb774bdf227ded577c1ce2de.tar.gz gnunet-81405b6abff2f0b6fb774bdf227ded577c1ce2de.zip |
add condition for check_test_readyness; find kx_initiator
-rw-r--r-- | src/cadet/test_cadeT.c | 10 | ||||
-rw-r--r-- | src/cadet/test_cadeT_util.c | 41 | ||||
-rw-r--r-- | src/cadet/test_cadeT_util.h | 37 |
3 files changed, 47 insertions, 41 deletions
diff --git a/src/cadet/test_cadeT.c b/src/cadet/test_cadeT.c index 70f141514..ee6bcd9e1 100644 --- a/src/cadet/test_cadeT.c +++ b/src/cadet/test_cadeT.c | |||
@@ -30,7 +30,7 @@ | |||
30 | * x setup peer B | 30 | * x setup peer B |
31 | * x setup cadet on peer B listening on port "cadet_port" | 31 | * x setup cadet on peer B listening on port "cadet_port" |
32 | * x create a channel from peer A to B | 32 | * x create a channel from peer A to B |
33 | * - create method to find out KX initiator | 33 | * x create method to find out KX initiator |
34 | * - send a message over channel | 34 | * - send a message over channel |
35 | * - check if message was received | 35 | * - check if message was received |
36 | * - breakup the connection without sending a channel destroy message | 36 | * - breakup the connection without sending a channel destroy message |
@@ -59,11 +59,19 @@ | |||
59 | 59 | ||
60 | /****************************** TEST LOGIC ********************************/ | 60 | /****************************** TEST LOGIC ********************************/ |
61 | 61 | ||
62 | static int kx_initiator; | ||
63 | |||
62 | void | 64 | void |
63 | run_test () | 65 | run_test () |
64 | { | 66 | { |
65 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); | 67 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); |
66 | 68 | ||
69 | kx_initiator = (0 < GNUNET_memcmp (&test_peers[0].id, &test_peers[1].id)) ? 1 : 0; | ||
70 | |||
71 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
72 | "KX initiator is peer %s\n", | ||
73 | GNUNET_i2s (&test_peers[kx_initiator].id)); | ||
74 | |||
67 | /** | 75 | /** |
68 | * This function is called after all testbed management is done and the | 76 | * This function is called after all testbed management is done and the |
69 | * testbed peers are ready for the actual test logic. | 77 | * testbed peers are ready for the actual test logic. |
diff --git a/src/cadet/test_cadeT_util.c b/src/cadet/test_cadeT_util.c index 6580b9907..fc59349aa 100644 --- a/src/cadet/test_cadeT_util.c +++ b/src/cadet/test_cadeT_util.c | |||
@@ -50,43 +50,6 @@ int test_result = 0; | |||
50 | */ | 50 | */ |
51 | static int peerinfo_cnt = 0; | 51 | static int peerinfo_cnt = 0; |
52 | 52 | ||
53 | /** | ||
54 | * Structure for storing information of testbed peers. | ||
55 | */ | ||
56 | struct TEST_PEERS | ||
57 | { | ||
58 | /** | ||
59 | * Index of the peer. | ||
60 | */ | ||
61 | int idx; | ||
62 | |||
63 | /** | ||
64 | * Peer Identity. | ||
65 | */ | ||
66 | struct GNUNET_PeerIdentity id; | ||
67 | |||
68 | /** | ||
69 | * Handle of TESTBED peer. | ||
70 | */ | ||
71 | struct GNUNET_TESTBED_Peer *testbed_peer; | ||
72 | |||
73 | /** | ||
74 | * Testbed management is finished and test peer is ready for test logic. | ||
75 | */ | ||
76 | int ready; | ||
77 | |||
78 | /** | ||
79 | * Channel of initiating peer. | ||
80 | */ | ||
81 | struct GNUNET_CADET_Channel *channel; | ||
82 | |||
83 | /** | ||
84 | * CADET handle. | ||
85 | */ | ||
86 | struct GNUNET_CADET_Handle *cadet; | ||
87 | |||
88 | } test_peers[REQUESTED_PEERS]; | ||
89 | |||
90 | /************************** TESBED MANAGEMENT *****************************/ | 53 | /************************** TESBED MANAGEMENT *****************************/ |
91 | 54 | ||
92 | static void | 55 | static void |
@@ -197,9 +160,7 @@ check_test_readyness (void *cls, | |||
197 | { | 160 | { |
198 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); | 161 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); |
199 | 162 | ||
200 | // FIXME: check, if all peers are ready, then continue with the | 163 | if (NULL != test_peers[0].cadet && NULL != test_peers[1].cadet) |
201 | // test logic. | ||
202 | if (GNUNET_OK) | ||
203 | run_test(); | 164 | run_test(); |
204 | } | 165 | } |
205 | 166 | ||
diff --git a/src/cadet/test_cadeT_util.h b/src/cadet/test_cadeT_util.h index b2afa34a1..7b92dc2cb 100644 --- a/src/cadet/test_cadeT_util.h +++ b/src/cadet/test_cadeT_util.h | |||
@@ -36,3 +36,40 @@ int test_result; | |||
36 | void prepare_test (); | 36 | void prepare_test (); |
37 | 37 | ||
38 | void run_test (); | 38 | void run_test (); |
39 | |||
40 | /** | ||
41 | * Structure for storing information of testbed peers. | ||
42 | */ | ||
43 | struct TEST_PEERS | ||
44 | { | ||
45 | /** | ||
46 | * Index of the peer. | ||
47 | */ | ||
48 | int idx; | ||
49 | |||
50 | /** | ||
51 | * Peer Identity. | ||
52 | */ | ||
53 | struct GNUNET_PeerIdentity id; | ||
54 | |||
55 | /** | ||
56 | * Handle of TESTBED peer. | ||
57 | */ | ||
58 | struct GNUNET_TESTBED_Peer *testbed_peer; | ||
59 | |||
60 | /** | ||
61 | * Testbed management is finished and test peer is ready for test logic. | ||
62 | */ | ||
63 | int ready; | ||
64 | |||
65 | /** | ||
66 | * Channel of initiating peer. | ||
67 | */ | ||
68 | struct GNUNET_CADET_Channel *channel; | ||
69 | |||
70 | /** | ||
71 | * CADET handle. | ||
72 | */ | ||
73 | struct GNUNET_CADET_Handle *cadet; | ||
74 | |||
75 | } test_peers[REQUESTED_PEERS]; | ||