diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index dfeeebd3b..4d5c09260 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -189,6 +189,11 @@ struct CadetPeer | |||
189 | * Hello message. | 189 | * Hello message. |
190 | */ | 190 | */ |
191 | struct GNUNET_HELLO_Message* hello; | 191 | struct GNUNET_HELLO_Message* hello; |
192 | |||
193 | /** | ||
194 | * Handle to us offering the HELLO to the transport. | ||
195 | */ | ||
196 | struct GNUNET_TRANSPORT_OfferHelloHandle *hello_offer; | ||
192 | }; | 197 | }; |
193 | 198 | ||
194 | 199 | ||
@@ -742,7 +747,9 @@ peer_destroy (struct CadetPeer *peer) | |||
742 | while (NULL != p) | 747 | while (NULL != p) |
743 | { | 748 | { |
744 | nextp = p->next; | 749 | nextp = p->next; |
745 | GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, p); | 750 | GNUNET_CONTAINER_DLL_remove (peer->path_head, |
751 | peer->path_tail, | ||
752 | p); | ||
746 | path_destroy (p); | 753 | path_destroy (p); |
747 | p = nextp; | 754 | p = nextp; |
748 | } | 755 | } |
@@ -755,6 +762,11 @@ peer_destroy (struct CadetPeer *peer) | |||
755 | } | 762 | } |
756 | if (NULL != peer->core_transmit) | 763 | if (NULL != peer->core_transmit) |
757 | GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit); | 764 | GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit); |
765 | if (NULL != peer->hello_offer) | ||
766 | { | ||
767 | GNUNET_TRANSPORT_offer_hello_cancel (peer->hello_offer); | ||
768 | peer->hello_offer = NULL; | ||
769 | } | ||
758 | GNUNET_free_non_null (peer->hello); | 770 | GNUNET_free_non_null (peer->hello); |
759 | GNUNET_free (peer); | 771 | GNUNET_free (peer); |
760 | return GNUNET_OK; | 772 | return GNUNET_OK; |
@@ -1906,10 +1918,12 @@ GCP_get_short (const GNUNET_PEER_Id peer, int create) | |||
1906 | * @param tc TaskContext. | 1918 | * @param tc TaskContext. |
1907 | */ | 1919 | */ |
1908 | static void | 1920 | static void |
1909 | try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1921 | try_connect (void *cls, |
1922 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1910 | { | 1923 | { |
1911 | struct CadetPeer *peer = cls; | 1924 | struct CadetPeer *peer = cls; |
1912 | 1925 | ||
1926 | peer->hello_offer = NULL; | ||
1913 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 1927 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
1914 | return; | 1928 | return; |
1915 | 1929 | ||
@@ -1934,8 +1948,9 @@ GCP_connect (struct CadetPeer *peer) | |||
1934 | int rerun_search; | 1948 | int rerun_search; |
1935 | 1949 | ||
1936 | GCC_check_connections (); | 1950 | GCC_check_connections (); |
1937 | LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GCP_2s (peer)); | 1951 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1938 | 1952 | "peer_connect towards %s\n", | |
1953 | GCP_2s (peer)); | ||
1939 | /* If we have a current hello, try to connect using it. */ | 1954 | /* If we have a current hello, try to connect using it. */ |
1940 | GCP_try_connect (peer); | 1955 | GCP_try_connect (peer); |
1941 | 1956 | ||
@@ -2539,10 +2554,10 @@ GCP_try_connect (struct CadetPeer *peer) | |||
2539 | return; | 2554 | return; |
2540 | 2555 | ||
2541 | mh = GNUNET_HELLO_get_header (hello); | 2556 | mh = GNUNET_HELLO_get_header (hello); |
2542 | GNUNET_TRANSPORT_offer_hello (transport_handle, | 2557 | peer->hello_offer = GNUNET_TRANSPORT_offer_hello (transport_handle, |
2543 | mh, | 2558 | mh, |
2544 | &try_connect, | 2559 | &try_connect, |
2545 | peer); | 2560 | peer); |
2546 | GCC_check_connections (); | 2561 | GCC_check_connections (); |
2547 | } | 2562 | } |
2548 | 2563 | ||