diff options
Diffstat (limited to 'src/service/topology/gnunet-daemon-topology.c')
-rw-r--r-- | src/service/topology/gnunet-daemon-topology.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/service/topology/gnunet-daemon-topology.c b/src/service/topology/gnunet-daemon-topology.c index 71cc5bd19..ca5435657 100644 --- a/src/service/topology/gnunet-daemon-topology.c +++ b/src/service/topology/gnunet-daemon-topology.c | |||
@@ -179,6 +179,16 @@ static unsigned int connection_count; | |||
179 | static unsigned int target_connection_count; | 179 | static unsigned int target_connection_count; |
180 | 180 | ||
181 | /** | 181 | /** |
182 | * Head of the linkd list to store the store context for hellos. | ||
183 | */ | ||
184 | static struct GNUNET_PEERSTORE_StoreHelloContext *shc_head; | ||
185 | |||
186 | /** | ||
187 | * Tail of the linkd list to store the store context for hellos. | ||
188 | */ | ||
189 | static struct GNUNET_PEERSTORE_StoreHelloContext *shc_tail; | ||
190 | |||
191 | /** | ||
182 | * Free all resources associated with the given peer. | 192 | * Free all resources associated with the given peer. |
183 | * | 193 | * |
184 | * @param cls closure (not used) | 194 | * @param cls closure (not used) |
@@ -833,7 +843,14 @@ check_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
833 | static void | 843 | static void |
834 | shc_cont (void *cls, int success) | 844 | shc_cont (void *cls, int success) |
835 | { | 845 | { |
836 | GNUNET_free (cls); | 846 | (void *) cls; |
847 | |||
848 | if (GNUNET_YES == success) | ||
849 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
850 | "Hello stored successfully!\n"); | ||
851 | else | ||
852 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
853 | "Error storing hello!\n"); | ||
837 | } | 854 | } |
838 | 855 | ||
839 | 856 | ||
@@ -860,8 +877,8 @@ handle_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
860 | 1, | 877 | 1, |
861 | GNUNET_NO); | 878 | GNUNET_NO); |
862 | GNUNET_HELLO_builder_from_msg (message); | 879 | GNUNET_HELLO_builder_from_msg (message); |
863 | // FIXME this is not working shc uninitialized | 880 | shc = GNUNET_PEERSTORE_hello_add (ps, message, &shc_cont, NULL); |
864 | shc = GNUNET_PEERSTORE_hello_add (ps, message, &shc_cont, shc); | 881 | GNUNET_CONTAINER_DLL_insert (shc_head, shc_tail, shc); |
865 | GNUNET_HELLO_builder_free (builder); | 882 | GNUNET_HELLO_builder_free (builder); |
866 | } | 883 | } |
867 | 884 | ||
@@ -875,6 +892,14 @@ handle_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
875 | static void | 892 | static void |
876 | cleaning_task (void *cls) | 893 | cleaning_task (void *cls) |
877 | { | 894 | { |
895 | struct GNUNET_PEERSTORE_StoreHelloContext *pos; | ||
896 | |||
897 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Topology shutdown\n"); | ||
898 | while (NULL != (pos = shc_head)) | ||
899 | { | ||
900 | GNUNET_CONTAINER_DLL_remove (shc_head, shc_tail, pos); | ||
901 | GNUNET_PEERSTORE_hello_add_cancel (pos); | ||
902 | } | ||
878 | if (NULL != peerstore_notify) | 903 | if (NULL != peerstore_notify) |
879 | { | 904 | { |
880 | GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify); | 905 | GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify); |