diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-11-14 13:57:58 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-11-14 13:57:58 +0000 |
commit | 053fc309fa633d585a6e1171f06f4dec39930056 (patch) | |
tree | f3037f4583a88c4d1e42f996600574e4eac7a6f9 | |
parent | b99b64811abb0f9a4f53856b645112ae39bf06d8 (diff) | |
download | gnunet-053fc309fa633d585a6e1171f06f4dec39930056.tar.gz gnunet-053fc309fa633d585a6e1171f06f4dec39930056.zip |
-fix slave crashes
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 18709b5db..f336b12a7 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c | |||
@@ -668,6 +668,11 @@ struct RequestOverlayConnectContext | |||
668 | * The transport handle of peer B | 668 | * The transport handle of peer B |
669 | */ | 669 | */ |
670 | struct GNUNET_TRANSPORT_Handle *th; | 670 | struct GNUNET_TRANSPORT_Handle *th; |
671 | |||
672 | /** | ||
673 | * The peer handle of peer B | ||
674 | */ | ||
675 | struct Peer *peer; | ||
671 | 676 | ||
672 | /** | 677 | /** |
673 | * Peer A's HELLO | 678 | * Peer A's HELLO |
@@ -2902,9 +2907,9 @@ overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer, | |||
2902 | if (NULL != occ->p2th) | 2907 | if (NULL != occ->p2th) |
2903 | { | 2908 | { |
2904 | GNUNET_TRANSPORT_disconnect (occ->p2th); | 2909 | GNUNET_TRANSPORT_disconnect (occ->p2th); |
2910 | occ->p2th = NULL; | ||
2905 | peer_list[occ->other_peer_id]->reference_cnt--; | 2911 | peer_list[occ->other_peer_id]->reference_cnt--; |
2906 | } | 2912 | } |
2907 | occ->p2th = NULL; | ||
2908 | LOG_DEBUG ("Peers connected - Sending overlay connect success\n"); | 2913 | LOG_DEBUG ("Peers connected - Sending overlay connect success\n"); |
2909 | msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage)); | 2914 | msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage)); |
2910 | msg->header.size = | 2915 | msg->header.size = |
@@ -3553,15 +3558,20 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
3553 | static void | 3558 | static void |
3554 | cleanup_rocc (struct RequestOverlayConnectContext *rocc) | 3559 | cleanup_rocc (struct RequestOverlayConnectContext *rocc) |
3555 | { | 3560 | { |
3561 | LOG_DEBUG ("Cleaning up rocc\n"); | ||
3556 | if (GNUNET_SCHEDULER_NO_TASK != rocc->attempt_connect_task_id) | 3562 | if (GNUNET_SCHEDULER_NO_TASK != rocc->attempt_connect_task_id) |
3557 | GNUNET_SCHEDULER_cancel (rocc->attempt_connect_task_id); | 3563 | GNUNET_SCHEDULER_cancel (rocc->attempt_connect_task_id); |
3558 | if (GNUNET_SCHEDULER_NO_TASK != rocc->timeout_rocc_task_id) | 3564 | if (GNUNET_SCHEDULER_NO_TASK != rocc->timeout_rocc_task_id) |
3559 | GNUNET_SCHEDULER_cancel (rocc->timeout_rocc_task_id); | 3565 | GNUNET_SCHEDULER_cancel (rocc->timeout_rocc_task_id); |
3560 | GNUNET_TRANSPORT_disconnect (rocc->th); | ||
3561 | if (NULL != rocc->tch) | 3566 | if (NULL != rocc->tch) |
3562 | GNUNET_TRANSPORT_try_connect_cancel (rocc->tch); | 3567 | GNUNET_TRANSPORT_try_connect_cancel (rocc->tch); |
3563 | if (NULL != rocc->ohh) | 3568 | if (NULL != rocc->ohh) |
3564 | GNUNET_TRANSPORT_offer_hello_cancel (rocc->ohh); | 3569 | GNUNET_TRANSPORT_offer_hello_cancel (rocc->ohh); |
3570 | GNUNET_TRANSPORT_disconnect (rocc->th); | ||
3571 | rocc->peer->reference_cnt--; | ||
3572 | if ((GNUNET_YES == rocc->peer->destroy_flag) | ||
3573 | && (0 == rocc->peer->reference_cnt)) | ||
3574 | destroy_peer (rocc->peer); | ||
3565 | GNUNET_free_non_null (rocc->hello); | 3575 | GNUNET_free_non_null (rocc->hello); |
3566 | GNUNET_CONTAINER_DLL_remove (roccq_head, roccq_tail, rocc); | 3576 | GNUNET_CONTAINER_DLL_remove (roccq_head, roccq_tail, rocc); |
3567 | GNUNET_free (rocc); | 3577 | GNUNET_free (rocc); |
@@ -3752,7 +3762,9 @@ handle_overlay_request_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
3752 | } | 3762 | } |
3753 | rocc = GNUNET_malloc (sizeof (struct RequestOverlayConnectContext)); | 3763 | rocc = GNUNET_malloc (sizeof (struct RequestOverlayConnectContext)); |
3754 | GNUNET_CONTAINER_DLL_insert_tail (roccq_head, roccq_tail, rocc); | 3764 | GNUNET_CONTAINER_DLL_insert_tail (roccq_head, roccq_tail, rocc); |
3755 | rocc->th = GNUNET_TRANSPORT_connect (peer->details.local.cfg, NULL, rocc, | 3765 | rocc->peer = peer; |
3766 | rocc->peer->reference_cnt++; | ||
3767 | rocc->th = GNUNET_TRANSPORT_connect (rocc->peer->details.local.cfg, NULL, rocc, | ||
3756 | NULL, &transport_connect_notify, NULL); | 3768 | NULL, &transport_connect_notify, NULL); |
3757 | if (NULL == rocc->th) | 3769 | if (NULL == rocc->th) |
3758 | { | 3770 | { |