aboutsummaryrefslogtreecommitdiff
path: root/src/service/hostlist/gnunet-daemon-hostlist_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/hostlist/gnunet-daemon-hostlist_client.c')
-rw-r--r--src/service/hostlist/gnunet-daemon-hostlist_client.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/service/hostlist/gnunet-daemon-hostlist_client.c b/src/service/hostlist/gnunet-daemon-hostlist_client.c
index 483233fc6..75b497d14 100644
--- a/src/service/hostlist/gnunet-daemon-hostlist_client.c
+++ b/src/service/hostlist/gnunet-daemon-hostlist_client.c
@@ -323,7 +323,7 @@ static struct GNUNET_PEERSTORE_Handle *peerstore;
323static void 323static void
324shc_cont (void *cls, int success) 324shc_cont (void *cls, int success)
325{ 325{
326 (void *) cls; 326 struct GNUNET_PEERSTORE_StoreHelloContextClosure *shc_cls = cls;
327 327
328 if (GNUNET_YES == success) 328 if (GNUNET_YES == success)
329 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 329 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -331,6 +331,7 @@ shc_cont (void *cls, int success)
331 else 331 else
332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
333 "Error storing hostlist entry!\n"); 333 "Error storing hostlist entry!\n");
334 GNUNET_CONTAINER_DLL_remove (shc_head, shc_tail, shc_cls->shc);
334} 335}
335 336
336 337
@@ -348,6 +349,7 @@ callback_download (void *ptr, size_t size, size_t nmemb, void *ctx)
348{ 349{
349 static char download_buffer[GNUNET_MAX_MESSAGE_SIZE - 1]; 350 static char download_buffer[GNUNET_MAX_MESSAGE_SIZE - 1];
350 struct GNUNET_PEERSTORE_StoreHelloContext *shc; 351 struct GNUNET_PEERSTORE_StoreHelloContext *shc;
352 struct GNUNET_PEERSTORE_StoreHelloContextClosure *shc_cls;
351 const char *cbuf = ptr; 353 const char *cbuf = ptr;
352 const struct GNUNET_MessageHeader *msg; 354 const struct GNUNET_MessageHeader *msg;
353 size_t total; 355 size_t total;
@@ -411,11 +413,16 @@ callback_download (void *ptr, size_t size, size_t nmemb, void *ctx)
411 1, 413 1,
412 GNUNET_NO); 414 GNUNET_NO);
413 stat_hellos_obtained++; 415 stat_hellos_obtained++;
416 shc_cls = GNUNET_new (struct GNUNET_PEERSTORE_StoreHelloContextClosure);
414 shc = GNUNET_PEERSTORE_hello_add (peerstore, 417 shc = GNUNET_PEERSTORE_hello_add (peerstore,
415 msg, 418 msg,
416 shc_cont, 419 shc_cont,
417 NULL); 420 shc_cls);
418 GNUNET_CONTAINER_DLL_insert (shc_head, shc_tail, shc); 421 if (NULL != shc)
422 {
423 shc_cls->shc = shc;
424 GNUNET_CONTAINER_DLL_insert (shc_head, shc_tail, shc);
425 }
419 memmove (download_buffer, &download_buffer[msize], download_pos - msize); 426 memmove (download_buffer, &download_buffer[msize], download_pos - msize);
420 download_pos -= msize; 427 download_pos -= msize;
421 } 428 }