diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/transport/test_transport_api.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r-- | src/transport/test_transport_api.c | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index f9ac6a8e5..02d80d410 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -115,8 +115,7 @@ end_badly () | |||
115 | 115 | ||
116 | 116 | ||
117 | static void | 117 | static void |
118 | notify_receive (void *cls, | 118 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
119 | const struct GNUNET_PeerIdentity *peer, | ||
120 | const struct GNUNET_MessageHeader *message, | 119 | const struct GNUNET_MessageHeader *message, |
121 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 120 | const struct GNUNET_TRANSPORT_ATS_Information *ats, |
122 | uint32_t ats_count) | 121 | uint32_t ats_count) |
@@ -164,30 +163,27 @@ notify_ready (void *cls, size_t size, void *buf) | |||
164 | 163 | ||
165 | 164 | ||
166 | static void | 165 | static void |
167 | notify_connect (void *cls, | 166 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, |
168 | const struct GNUNET_PeerIdentity *peer, | ||
169 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 167 | const struct GNUNET_TRANSPORT_ATS_Information *ats, |
170 | uint32_t ats_count) | 168 | uint32_t ats_count) |
171 | { | 169 | { |
172 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 170 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n", |
173 | "Peer `%4s' connected to us (%p)!\n", GNUNET_i2s (peer), cls); | 171 | GNUNET_i2s (peer), cls); |
174 | } | 172 | } |
175 | 173 | ||
176 | 174 | ||
177 | static void | 175 | static void |
178 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | 176 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) |
179 | { | 177 | { |
180 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' disconnected (%p)!\n", |
181 | "Peer `%4s' disconnected (%p)!\n", GNUNET_i2s (peer), cls); | 179 | GNUNET_i2s (peer), cls); |
182 | } | 180 | } |
183 | 181 | ||
184 | static void | 182 | static void |
185 | sendtask () | 183 | sendtask () |
186 | { | 184 | { |
187 | th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, | 185 | th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0, TIMEOUT, |
188 | &p2->id, | 186 | ¬ify_ready, &p1); |
189 | 256, 0, TIMEOUT, ¬ify_ready, | ||
190 | &p1); | ||
191 | } | 187 | } |
192 | 188 | ||
193 | static void | 189 | static void |
@@ -195,8 +191,8 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
195 | { | 191 | { |
196 | char *p1_c = strdup (GNUNET_i2s (&p1->id)); | 192 | char *p1_c = strdup (GNUNET_i2s (&p1->id)); |
197 | 193 | ||
198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", | 194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %s <-> %s\n", p1_c, |
199 | p1_c, GNUNET_i2s (&p2->id)); | 195 | GNUNET_i2s (&p2->id)); |
200 | GNUNET_free (p1_c); | 196 | GNUNET_free (p1_c); |
201 | 197 | ||
202 | // FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG! | 198 | // FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG! |
@@ -204,20 +200,17 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
204 | } | 200 | } |
205 | 201 | ||
206 | static void | 202 | static void |
207 | run (void *cls, | 203 | run (void *cls, char *const *args, const char *cfgfile, |
208 | char *const *args, | 204 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
209 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
210 | { | 205 | { |
211 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 206 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
212 | 207 | ||
213 | p1 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p1, | 208 | p1 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p1, ¬ify_receive, |
214 | ¬ify_receive, | 209 | ¬ify_connect, ¬ify_disconnect, |
215 | ¬ify_connect, | 210 | NULL); |
216 | ¬ify_disconnect, NULL); | 211 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, ¬ify_receive, |
217 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, | 212 | ¬ify_connect, ¬ify_disconnect, |
218 | ¬ify_receive, | 213 | NULL); |
219 | ¬ify_connect, | ||
220 | ¬ify_disconnect, NULL); | ||
221 | 214 | ||
222 | GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb, NULL); | 215 | GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb, NULL); |
223 | } | 216 | } |
@@ -241,8 +234,8 @@ check () | |||
241 | setTransportOptions ("test_transport_api_data.conf"); | 234 | setTransportOptions ("test_transport_api_data.conf"); |
242 | #endif | 235 | #endif |
243 | ok = 1; | 236 | ok = 1; |
244 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 237 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
245 | argv, "test-transport-api", "nohelp", options, &run, &ok); | 238 | "test-transport-api", "nohelp", options, &run, &ok); |
246 | 239 | ||
247 | return ok; | 240 | return ok; |
248 | } | 241 | } |
@@ -332,8 +325,8 @@ check_gnunet_nat_binary (char *binary) | |||
332 | } | 325 | } |
333 | if (0 != STAT (p, &statbuf)) | 326 | if (0 != STAT (p, &statbuf)) |
334 | { | 327 | { |
335 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 328 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("stat (%s) failed: %s\n"), p, |
336 | _("stat (%s) failed: %s\n"), p, STRERROR (errno)); | 329 | STRERROR (errno)); |
337 | GNUNET_free (p); | 330 | GNUNET_free (p); |
338 | return GNUNET_SYSERR; | 331 | return GNUNET_SYSERR; |
339 | } | 332 | } |