aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing.c')
-rw-r--r--src/transport/transport-testing.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c
index 4e11f2c78..ec0800842 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -455,14 +455,13 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth,
455 struct PeerContext *p) 455 struct PeerContext *p)
456{ 456{
457 GNUNET_assert (p != NULL); 457 GNUNET_assert (p != NULL);
458
459 if (p->ghh != NULL) 458 if (p->ghh != NULL)
459 {
460 GNUNET_TRANSPORT_get_hello_cancel (p->ghh); 460 GNUNET_TRANSPORT_get_hello_cancel (p->ghh);
461 p->ghh = NULL; 461 p->ghh = NULL;
462 462 }
463 if (p->th != NULL) 463 if (p->th != NULL)
464 GNUNET_TRANSPORT_disconnect (p->th); 464 GNUNET_TRANSPORT_disconnect (p->th);
465
466 if (NULL != p->arm_proc) 465 if (NULL != p->arm_proc)
467 { 466 {
468 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) 467 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
@@ -471,35 +470,31 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth,
471 GNUNET_OS_process_close (p->arm_proc); 470 GNUNET_OS_process_close (p->arm_proc);
472 p->arm_proc = NULL; 471 p->arm_proc = NULL;
473 } 472 }
474
475 if (p->hostkeyfile != NULL) 473 if (p->hostkeyfile != NULL)
476 { 474 {
477 GNUNET_DISK_directory_remove (p->hostkeyfile); 475 GNUNET_DISK_directory_remove (p->hostkeyfile);
478 GNUNET_free (p->hostkeyfile); 476 GNUNET_free (p->hostkeyfile);
479 } 477 }
480
481 if (p->servicehome != NULL) 478 if (p->servicehome != NULL)
482 { 479 {
483 GNUNET_DISK_directory_remove (p->servicehome); 480 GNUNET_DISK_directory_remove (p->servicehome);
484 GNUNET_free (p->servicehome); 481 GNUNET_free (p->servicehome);
485 } 482 }
486
487 if (p->hello != NULL) 483 if (p->hello != NULL)
484 {
488 GNUNET_free (p->hello); 485 GNUNET_free (p->hello);
489 p->hello = NULL; 486 p->hello = NULL;
490 487 }
491 if (p->cfg != NULL) 488 if (p->cfg != NULL)
489 {
492 GNUNET_CONFIGURATION_destroy (p->cfg); 490 GNUNET_CONFIGURATION_destroy (p->cfg);
493 p->cfg = NULL; 491 p->cfg = NULL;
494 492 }
495 GNUNET_CONTAINER_DLL_remove (tth->p_head, tth->p_tail, p); 493 GNUNET_CONTAINER_DLL_remove (tth->p_head, tth->p_tail, p);
496
497 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", 494 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
498 "Peer %u (`%s') stopped \n", p->no, 495 "Peer %u (`%s') stopped \n", p->no,
499 GNUNET_i2s (&p->id)); 496 GNUNET_i2s (&p->id));
500
501 GNUNET_free (p); 497 GNUNET_free (p);
502 p = NULL;
503} 498}
504 499
505 500
@@ -529,24 +524,18 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle *
529 524
530 GNUNET_assert (p1 != NULL); 525 GNUNET_assert (p1 != NULL);
531 GNUNET_assert (p2 != NULL); 526 GNUNET_assert (p2 != NULL);
532
533 cc->p1 = p1; 527 cc->p1 = p1;
534 cc->p2 = p2; 528 cc->p2 = p2;
535
536 cc->cb = cb; 529 cc->cb = cb;
537 if (cls != NULL) 530 if (cls != NULL)
538 cc->cb_cls = cls; 531 cc->cb_cls = cls;
539 else 532 else
540 cc->cb_cls = cc; 533 cc->cb_cls = cc;
541
542 cc->th_p1 = p1->th; 534 cc->th_p1 = p1->th;
543 cc->th_p2 = p2->th; 535 cc->th_p2 = p2->th;
544
545 GNUNET_assert (cc->th_p1 != NULL); 536 GNUNET_assert (cc->th_p1 != NULL);
546 GNUNET_assert (cc->th_p2 != NULL); 537 GNUNET_assert (cc->th_p2 != NULL);
547
548 GNUNET_CONTAINER_DLL_insert (tth->cc_head, tth->cc_tail, cc); 538 GNUNET_CONTAINER_DLL_insert (tth->cc_head, tth->cc_tail, cc);
549
550 cc->tct = GNUNET_SCHEDULER_add_now (&try_connect, cc); 539 cc->tct = GNUNET_SCHEDULER_add_now (&try_connect, cc);
551 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", 540 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
552 "New connect request %X\n", cc); 541 "New connect request %X\n", cc);