diff options
-rw-r--r-- | src/cadet/gnunet-service-cadet_dht.c | 12 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 31 |
2 files changed, 31 insertions, 12 deletions
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c index 2b9fdb0a3..fadf45e13 100644 --- a/src/cadet/gnunet-service-cadet_dht.c +++ b/src/cadet/gnunet-service-cadet_dht.c | |||
@@ -154,9 +154,9 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path, | |||
154 | * @param exp when will this value expire | 154 | * @param exp when will this value expire |
155 | * @param key key of the result | 155 | * @param key key of the result |
156 | * @param get_path path of the get request | 156 | * @param get_path path of the get request |
157 | * @param get_path_length lenght of get_path | 157 | * @param get_path_length lenght of @a get_path |
158 | * @param put_path path of the put request | 158 | * @param put_path path of the put request |
159 | * @param put_path_length length of the put_path | 159 | * @param put_path_length length of the @a put_path |
160 | * @param type type of the result | 160 | * @param type type of the result |
161 | * @param size number of bytes in data | 161 | * @param size number of bytes in data |
162 | * @param data pointer to the result data | 162 | * @param data pointer to the result data |
@@ -185,11 +185,15 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
185 | } | 185 | } |
186 | 186 | ||
187 | s = path_2s (p); | 187 | s = path_2s (p); |
188 | LOG (GNUNET_ERROR_TYPE_INFO, "Got path from DHT: %s\n", s); | 188 | LOG (GNUNET_ERROR_TYPE_INFO, |
189 | "Got path from DHT: %s\n", | ||
190 | s); | ||
189 | GNUNET_free_non_null (s); | 191 | GNUNET_free_non_null (s); |
190 | 192 | ||
191 | peer = GCP_get_short (p->peers[p->length - 1], GNUNET_YES); | 193 | peer = GCP_get_short (p->peers[p->length - 1], GNUNET_YES); |
192 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GCP_2s (peer)); | 194 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
195 | "Got HELLO for %s\n", | ||
196 | GCP_2s (peer)); | ||
193 | h->callback (h->cls, p); | 197 | h->callback (h->cls, p); |
194 | path_destroy (p); | 198 | path_destroy (p); |
195 | hello = (struct GNUNET_HELLO_Message *) data; | 199 | hello = (struct GNUNET_HELLO_Message *) data; |
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 | ||