diff options
Diffstat (limited to 'src/testing/test_testing_reconnect.c')
-rw-r--r-- | src/testing/test_testing_reconnect.c | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/src/testing/test_testing_reconnect.c b/src/testing/test_testing_reconnect.c index 7cec78f98..1e028779f 100644 --- a/src/testing/test_testing_reconnect.c +++ b/src/testing/test_testing_reconnect.c | |||
@@ -54,51 +54,50 @@ static int phase; | |||
54 | * Run the next phase of starting daemons, connecting them and | 54 | * Run the next phase of starting daemons, connecting them and |
55 | * stopping them again. | 55 | * stopping them again. |
56 | */ | 56 | */ |
57 | static void | 57 | static void run_phase (); |
58 | run_phase (); | ||
59 | 58 | ||
60 | static void | 59 | static void |
61 | end2_cb (void *cls, const char *emsg) | 60 | end2_cb (void *cls, const char *emsg) |
62 | { | 61 | { |
63 | 62 | ||
64 | if (emsg != NULL) | 63 | if (emsg != NULL) |
65 | { | 64 | { |
66 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ending with error: %s\n", emsg); | 65 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ending with error: %s\n", emsg); |
67 | ok = 1; | 66 | ok = 1; |
68 | } | 67 | } |
69 | else | 68 | else |
69 | { | ||
70 | if (phase < NUM_PHASES) | ||
70 | { | 71 | { |
71 | if (phase < NUM_PHASES) | 72 | fprintf (stderr, "."); |
72 | { | 73 | run_phase (); |
73 | fprintf (stderr, "."); | 74 | return; |
74 | run_phase(); | 75 | } |
75 | return; | 76 | fprintf (stderr, ".\n"); |
76 | } | ||
77 | fprintf (stderr, ".\n"); | ||
78 | #if VERBOSE | 77 | #if VERBOSE |
79 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 78 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
80 | "Both daemons terminated, will now exit.\n"); | 79 | "Both daemons terminated, will now exit.\n"); |
81 | #endif | 80 | #endif |
82 | ok = 0; | 81 | ok = 0; |
83 | } | 82 | } |
84 | } | 83 | } |
85 | 84 | ||
86 | static void | 85 | static void |
87 | end1_cb (void *cls, const char *emsg) | 86 | end1_cb (void *cls, const char *emsg) |
88 | { | 87 | { |
89 | if (emsg != NULL) | 88 | if (emsg != NULL) |
90 | { | 89 | { |
91 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Stopping daemon 1 gave: %s\n", | 90 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Stopping daemon 1 gave: %s\n", |
92 | emsg); | 91 | emsg); |
93 | ok = 1; | 92 | ok = 1; |
94 | } | 93 | } |
95 | else | 94 | else |
96 | { | 95 | { |
97 | ok = 0; | 96 | ok = 0; |
98 | } | 97 | } |
99 | 98 | ||
100 | GNUNET_TESTING_daemon_stop (d2, TIMEOUT, &end2_cb, NULL, | 99 | GNUNET_TESTING_daemon_stop (d2, TIMEOUT, &end2_cb, NULL, |
101 | (phase == NUM_PHASES) ? GNUNET_YES : GNUNET_NO, | 100 | (phase == NUM_PHASES) ? GNUNET_YES : GNUNET_NO, |
102 | GNUNET_NO); | 101 | GNUNET_NO); |
103 | d2 = NULL; | 102 | d2 = NULL; |
104 | } | 103 | } |
@@ -106,8 +105,8 @@ end1_cb (void *cls, const char *emsg) | |||
106 | static void | 105 | static void |
107 | finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 106 | finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
108 | { | 107 | { |
109 | GNUNET_TESTING_daemon_stop (d1, TIMEOUT, &end1_cb, NULL, | 108 | GNUNET_TESTING_daemon_stop (d1, TIMEOUT, &end1_cb, NULL, |
110 | (phase == NUM_PHASES) ? GNUNET_YES : GNUNET_NO, | 109 | (phase == NUM_PHASES) ? GNUNET_YES : GNUNET_NO, |
111 | GNUNET_NO); | 110 | GNUNET_NO); |
112 | d1 = NULL; | 111 | d1 = NULL; |
113 | } | 112 | } |
@@ -147,8 +146,7 @@ my_cb2 (void *cls, | |||
147 | #endif | 146 | #endif |
148 | GNUNET_TESTING_daemons_connect (d1, d2, | 147 | GNUNET_TESTING_daemons_connect (d1, d2, |
149 | TIMEOUT, CONNECT_ATTEMPTS, | 148 | TIMEOUT, CONNECT_ATTEMPTS, |
150 | GNUNET_YES, | 149 | GNUNET_YES, &my_connect_complete, NULL); |
151 | &my_connect_complete, NULL); | ||
152 | } | 150 | } |
153 | 151 | ||
154 | 152 | ||
@@ -163,9 +161,8 @@ my_cb1 (void *cls, | |||
163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 161 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
164 | "Daemon `%s' started.\n", GNUNET_i2s (id)); | 162 | "Daemon `%s' started.\n", GNUNET_i2s (id)); |
165 | #endif | 163 | #endif |
166 | d2 = | 164 | d2 = GNUNET_TESTING_daemon_start (c2, TIMEOUT, GNUNET_NO, NULL, NULL, 0, NULL, |
167 | GNUNET_TESTING_daemon_start (c2, TIMEOUT, GNUNET_NO, NULL, NULL, 0, NULL, NULL, NULL, | 165 | NULL, NULL, &my_cb2, NULL); |
168 | &my_cb2, NULL); | ||
169 | GNUNET_assert (d2 != NULL); | 166 | GNUNET_assert (d2 != NULL); |
170 | } | 167 | } |
171 | 168 | ||
@@ -186,13 +183,12 @@ run (void *cls, | |||
186 | run_phase (); | 183 | run_phase (); |
187 | } | 184 | } |
188 | 185 | ||
189 | static void | 186 | static void |
190 | run_phase () | 187 | run_phase () |
191 | { | 188 | { |
192 | phase++; | 189 | phase++; |
193 | d1 = | 190 | d1 = GNUNET_TESTING_daemon_start (c1, TIMEOUT, GNUNET_NO, NULL, NULL, 0, NULL, |
194 | GNUNET_TESTING_daemon_start (c1, TIMEOUT, GNUNET_NO, NULL, NULL, 0, NULL, NULL, NULL, | 191 | NULL, NULL, &my_cb1, NULL); |
195 | &my_cb1, NULL); | ||
196 | GNUNET_assert (d1 != NULL); | 192 | GNUNET_assert (d1 != NULL); |
197 | } | 193 | } |
198 | 194 | ||