aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/transport/test_transport_api.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r--src/transport/test_transport_api.c51
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
117static void 117static void
118notify_receive (void *cls, 118notify_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
166static void 165static void
167notify_connect (void *cls, 166notify_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
177static void 175static void
178notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) 176notify_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
184static void 182static void
185sendtask () 183sendtask ()
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 &notify_ready, &p1);
189 256, 0, TIMEOUT, &notify_ready,
190 &p1);
191} 187}
192 188
193static void 189static 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
206static void 202static void
207run (void *cls, 203run (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, &notify_receive,
214 &notify_receive, 209 &notify_connect, &notify_disconnect,
215 &notify_connect, 210 NULL);
216 &notify_disconnect, NULL); 211 p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, &notify_receive,
217 p2 = GNUNET_TRANSPORT_TESTING_start_peer (cfg_file_p2, 212 &notify_connect, &notify_disconnect,
218 &notify_receive, 213 NULL);
219 &notify_connect,
220 &notify_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 }