aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api_cmd_start_peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport_api_cmd_start_peer.c')
-rw-r--r--src/transport/transport_api_cmd_start_peer.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index c9af497ae..c2cc20a2a 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -54,7 +54,7 @@ struct StartPeerState
54 /** 54 /**
55 * Peer identity 55 * Peer identity
56 */ 56 */
57 struct GNUNET_PeerIdentity *id; 57 struct GNUNET_PeerIdentity id;
58 58
59 /** 59 /**
60 * Peer's transport service handle 60 * Peer's transport service handle
@@ -145,7 +145,7 @@ retrieve_hello (void *cls)
145 sps->rh_task = NULL; 145 sps->rh_task = NULL;
146 sps->pic = GNUNET_PEERSTORE_iterate (sps->ph, 146 sps->pic = GNUNET_PEERSTORE_iterate (sps->ph,
147 "transport", 147 "transport",
148 sps->id, 148 &sps->id,
149 GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, 149 GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY,
150 hello_iter_cb, 150 hello_iter_cb,
151 sps); 151 sps);
@@ -179,7 +179,7 @@ notify_disconnect (void *cls,
179 "Peer %s disconnected from peer %u (`%s')\n", 179 "Peer %s disconnected from peer %u (`%s')\n",
180 GNUNET_i2s (peer), 180 GNUNET_i2s (peer),
181 sps->no, 181 sps->no,
182 GNUNET_i2s (sps->id)); 182 GNUNET_i2s (&sps->id));
183 183
184} 184}
185 185
@@ -199,7 +199,7 @@ notify_connect (void *cls,
199 "Peer %s connected to peer %u (`%s')\n", 199 "Peer %s connected to peer %u (`%s')\n",
200 GNUNET_i2s (peer), 200 GNUNET_i2s (peer),
201 sps->no, 201 sps->no,
202 GNUNET_i2s (sps->id)); 202 GNUNET_i2s (&sps->id));
203 203
204 GNUNET_CONTAINER_multipeermap_put (sps->connected_peers_map, 204 GNUNET_CONTAINER_multipeermap_put (sps->connected_peers_map,
205 peer, 205 peer,
@@ -222,6 +222,9 @@ start_peer_run (void *cls,
222 const struct GNUNET_TESTING_Command *system_cmd; 222 const struct GNUNET_TESTING_Command *system_cmd;
223 struct GNUNET_TESTING_System *tl_system; 223 struct GNUNET_TESTING_System *tl_system;
224 224
225 LOG (GNUNET_ERROR_TYPE_ERROR,
226 "start peer 1\n");
227
225 if (GNUNET_NO == GNUNET_DISK_file_test (sps->cfgname)) 228 if (GNUNET_NO == GNUNET_DISK_file_test (sps->cfgname))
226 { 229 {
227 LOG (GNUNET_ERROR_TYPE_ERROR, 230 LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -251,8 +254,11 @@ start_peer_run (void *cls,
251 sps->cfgname); 254 sps->cfgname);
252 GNUNET_CONFIGURATION_destroy (sps->cfg); 255 GNUNET_CONFIGURATION_destroy (sps->cfg);
253 GNUNET_TESTING_interpreter_fail (); 256 GNUNET_TESTING_interpreter_fail ();
257 return;
254 } 258 }
255 259
260 LOG (GNUNET_ERROR_TYPE_ERROR,
261 "start peer 2\n");
256 sps->peer = GNUNET_TESTING_peer_configure (sps->tl_system, 262 sps->peer = GNUNET_TESTING_peer_configure (sps->tl_system,
257 sps->cfg, 263 sps->cfg,
258 sps->no, 264 sps->no,
@@ -266,8 +272,11 @@ start_peer_run (void *cls,
266 emsg); 272 emsg);
267 GNUNET_free (emsg); 273 GNUNET_free (emsg);
268 GNUNET_TESTING_interpreter_fail (); 274 GNUNET_TESTING_interpreter_fail ();
275 return;
269 } 276 }
270 277
278 LOG (GNUNET_ERROR_TYPE_ERROR,
279 "start peer 3\n");
271 if (GNUNET_OK != GNUNET_TESTING_peer_start (sps->peer)) 280 if (GNUNET_OK != GNUNET_TESTING_peer_start (sps->peer))
272 { 281 {
273 LOG (GNUNET_ERROR_TYPE_ERROR, 282 LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -275,13 +284,19 @@ start_peer_run (void *cls,
275 sps->cfgname); 284 sps->cfgname);
276 GNUNET_free (emsg); 285 GNUNET_free (emsg);
277 GNUNET_TESTING_interpreter_fail (); 286 GNUNET_TESTING_interpreter_fail ();
287 return;
278 } 288 }
279 289LOG (GNUNET_ERROR_TYPE_ERROR,
290 "start peer 4\n");
280 memset (&dummy, 291 memset (&dummy,
281 '\0', 292 '\0',
282 sizeof(dummy)); 293 sizeof(dummy));
294 LOG (GNUNET_ERROR_TYPE_ERROR,
295 "start peer 4.1\n");
283 GNUNET_TESTING_peer_get_identity (sps->peer, 296 GNUNET_TESTING_peer_get_identity (sps->peer,
284 sps->id); 297 &sps->id);
298 LOG (GNUNET_ERROR_TYPE_ERROR,
299 "start peer 4.2\n");
285 if (0 == memcmp (&dummy, 300 if (0 == memcmp (&dummy,
286 &sps->id, 301 &sps->id,
287 sizeof(struct GNUNET_PeerIdentity))) 302 sizeof(struct GNUNET_PeerIdentity)))
@@ -291,11 +306,14 @@ start_peer_run (void *cls,
291 sps->no); 306 sps->no);
292 GNUNET_free (emsg); 307 GNUNET_free (emsg);
293 GNUNET_TESTING_interpreter_fail (); 308 GNUNET_TESTING_interpreter_fail ();
309 return;
294 } 310 }
295 LOG (GNUNET_ERROR_TYPE_DEBUG, 311 LOG (GNUNET_ERROR_TYPE_DEBUG,
296 "Peer %u configured with identity `%s'\n", 312 "Peer %u configured with identity `%s'\n",
297 sps->no, 313 sps->no,
298 GNUNET_i2s_full (sps->id)); 314 GNUNET_i2s_full (&sps->id));
315 LOG (GNUNET_ERROR_TYPE_ERROR,
316 "start peer 4.3\n");
299 sps->th = GNUNET_TRANSPORT_core_connect (sps->cfg, 317 sps->th = GNUNET_TRANSPORT_core_connect (sps->cfg,
300 NULL, 318 NULL,
301 sps->handlers, 319 sps->handlers,
@@ -310,7 +328,10 @@ start_peer_run (void *cls,
310 emsg); 328 emsg);
311 GNUNET_free (emsg); 329 GNUNET_free (emsg);
312 GNUNET_TESTING_interpreter_fail (); 330 GNUNET_TESTING_interpreter_fail ();
331 return;
313 } 332 }
333 LOG (GNUNET_ERROR_TYPE_ERROR,
334 "start peer 5\n");
314 sps->ph = GNUNET_PEERSTORE_connect (sps->cfg); 335 sps->ph = GNUNET_PEERSTORE_connect (sps->cfg);
315 if (NULL == sps->th) 336 if (NULL == sps->th)
316 { 337 {
@@ -320,7 +341,10 @@ start_peer_run (void *cls,
320 emsg); 341 emsg);
321 GNUNET_free (emsg); 342 GNUNET_free (emsg);
322 GNUNET_TESTING_interpreter_fail (); 343 GNUNET_TESTING_interpreter_fail ();
344 return;
323 } 345 }
346 LOG (GNUNET_ERROR_TYPE_ERROR,
347 "start peer 6\n");
324 sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg); 348 sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg);
325 if (NULL == sps->ah) 349 if (NULL == sps->ah)
326 { 350 {
@@ -330,6 +354,7 @@ start_peer_run (void *cls,
330 emsg); 354 emsg);
331 GNUNET_free (emsg); 355 GNUNET_free (emsg);
332 GNUNET_TESTING_interpreter_fail (); 356 GNUNET_TESTING_interpreter_fail ();
357 return;
333 } 358 }
334 sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); 359 sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps);
335} 360}
@@ -374,7 +399,7 @@ start_peer_cleanup (void *cls,
374 LOG (GNUNET_ERROR_TYPE_DEBUG, 399 LOG (GNUNET_ERROR_TYPE_DEBUG,
375 "Testing lib failed to stop peer %u (`%s')\n", 400 "Testing lib failed to stop peer %u (`%s')\n",
376 sps->no, 401 sps->no,
377 GNUNET_i2s (sps->id)); 402 GNUNET_i2s (&sps->id));
378 } 403 }
379 GNUNET_TESTING_peer_destroy (sps->peer); 404 GNUNET_TESTING_peer_destroy (sps->peer);
380 sps->peer = NULL; 405 sps->peer = NULL;
@@ -402,7 +427,7 @@ start_peer_traits (void *cls,
402{ 427{
403 struct StartPeerState *sps = cls; 428 struct StartPeerState *sps = cls;
404 struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah; 429 struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah;
405 struct GNUNET_PeerIdentity *id = sps->id; 430 struct GNUNET_PeerIdentity *id = &sps->id;
406 struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = 431 struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map =
407 sps->connected_peers_map; 432 sps->connected_peers_map;
408 char *hello = sps->hello; 433 char *hello = sps->hello;
@@ -528,6 +553,9 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
528 GNUNET_CONTAINER_multipeermap_create (1,GNUNET_NO); 553 GNUNET_CONTAINER_multipeermap_create (1,GNUNET_NO);
529 unsigned int i; 554 unsigned int i;
530 555
556 LOG (GNUNET_ERROR_TYPE_ERROR,
557 "start peer 0.1\n");
558
531 sps = GNUNET_new (struct StartPeerState); 559 sps = GNUNET_new (struct StartPeerState);
532 sps->m = m; 560 sps->m = m;
533 sps->n = n; 561 sps->n = n;
@@ -535,6 +563,9 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
535 sps->connected_peers_map = connected_peers_map; 563 sps->connected_peers_map = connected_peers_map;
536 sps->cfgname = cfgname; 564 sps->cfgname = cfgname;
537 565
566 LOG (GNUNET_ERROR_TYPE_ERROR,
567 "start peer 0.2\n");
568
538 if (NULL != handlers) 569 if (NULL != handlers)
539 { 570 {
540 for (i = 0; NULL != handlers[i].cb; i++) 571 for (i = 0; NULL != handlers[i].cb; i++)
@@ -546,6 +577,8 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
546 i * sizeof(struct GNUNET_MQ_MessageHandler)); 577 i * sizeof(struct GNUNET_MQ_MessageHandler));
547 } 578 }
548 579
580 LOG (GNUNET_ERROR_TYPE_ERROR,
581 "start peer 0.3\n");
549 struct GNUNET_TESTING_Command cmd = { 582 struct GNUNET_TESTING_Command cmd = {
550 .cls = sps, 583 .cls = sps,
551 .label = label, 584 .label = label,