aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/peerinfo_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-09 08:54:49 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-09 08:54:49 +0000
commit995ff4c783691df5462353d0ef4f698942de1010 (patch)
treecb929c9f4e91d09e932c233c73ae9f48808e46a0 /src/peerinfo/peerinfo_api.c
parente703948983a444cf4204913602aac2191d72dc8b (diff)
downloadgnunet-995ff4c783691df5462353d0ef4f698942de1010.tar.gz
gnunet-995ff4c783691df5462353d0ef4f698942de1010.zip
-fixing doxygen, indentation
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r--src/peerinfo/peerinfo_api.c139
1 files changed, 92 insertions, 47 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
index 716802389..20042f8e3 100644
--- a/src/peerinfo/peerinfo_api.c
+++ b/src/peerinfo/peerinfo_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2001, 2002, 2004, 2005, 2007, 2009, 2010, 2012 Christian Grothoff (and other contributing authors) 3 (C) 2001-2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -98,7 +98,7 @@ struct GNUNET_PEERINFO_IteratorContext
98 GNUNET_PEERINFO_Processor callback; 98 GNUNET_PEERINFO_Processor callback;
99 99
100 /** 100 /**
101 * Closure for 'callback'. 101 * Closure for @e callback.
102 */ 102 */
103 void *callback_cls; 103 void *callback_cls;
104 104
@@ -123,12 +123,12 @@ struct GNUNET_PEERINFO_IteratorContext
123 struct GNUNET_PeerIdentity peer; 123 struct GNUNET_PeerIdentity peer;
124 124
125 /** 125 /**
126 * Is 'peer' set? 126 * Is @e peer set?
127 */ 127 */
128 int have_peer; 128 int have_peer;
129 129
130 /** 130 /**
131 * Set to GNUNET_YES if we are currently receiving replies from the 131 * Set to #GNUNET_YES if we are currently receiving replies from the
132 * service. 132 * service.
133 */ 133 */
134 int request_transmitted; 134 int request_transmitted;
@@ -212,7 +212,7 @@ GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
212 * Disconnect from the peerinfo service. Note that all iterators must 212 * Disconnect from the peerinfo service. Note that all iterators must
213 * have completed or have been cancelled by the time this function is 213 * have completed or have been cancelled by the time this function is
214 * called (otherwise, calling this function is a serious error). 214 * called (otherwise, calling this function is a serious error).
215 * Furthermore, if 'GNUNET_PEERINFO_add_peer' operations are still 215 * Furthermore, if #GNUNET_PEERINFO_add_peer() operations are still
216 * pending, they will be cancelled silently on disconnect. 216 * pending, they will be cancelled silently on disconnect.
217 * 217 *
218 * @param h handle to disconnect 218 * @param h handle to disconnect
@@ -233,7 +233,8 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h)
233 { 233 {
234 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); 234 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac);
235 if (NULL != ac->cont) 235 if (NULL != ac->cont)
236 ac->cont (ac->cont_cls, _("aborted due to explicit disconnect request")); 236 ac->cont (ac->cont_cls,
237 _("aborted due to explicit disconnect request"));
237 GNUNET_free (ac); 238 GNUNET_free (ac);
238 } 239 }
239 if (NULL != h->th) 240 if (NULL != h->th)
@@ -277,11 +278,12 @@ reconnect (struct GNUNET_PEERINFO_Handle *h);
277/** 278/**
278 * Task scheduled to re-try connecting to the peerinfo service. 279 * Task scheduled to re-try connecting to the peerinfo service.
279 * 280 *
280 * @param cls the 'struct GNUNET_PEERINFO_Handle' 281 * @param cls the `struct GNUNET_PEERINFO_Handle *`
281 * @param tc scheduler context 282 * @param tc scheduler context
282 */ 283 */
283static void 284static void
284reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 285reconnect_task (void *cls,
286 const struct GNUNET_SCHEDULER_TaskContext *tc)
285{ 287{
286 struct GNUNET_PEERINFO_Handle *h = cls; 288 struct GNUNET_PEERINFO_Handle *h = cls;
287 289
@@ -318,7 +320,8 @@ reconnect (struct GNUNET_PEERINFO_Handle *h)
318 if (NULL == h->client) 320 if (NULL == h->client)
319 { 321 {
320 h->r_task = 322 h->r_task =
321 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect_task, 323 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
324 &reconnect_task,
322 h); 325 h);
323 return; 326 return;
324 } 327 }
@@ -330,13 +333,15 @@ reconnect (struct GNUNET_PEERINFO_Handle *h)
330 * Transmit the request at the head of the transmission queue 333 * Transmit the request at the head of the transmission queue
331 * and trigger continuation (if any). 334 * and trigger continuation (if any).
332 * 335 *
333 * @param cls the 'struct GNUNET_PEERINFO_Handle' (with the queue) 336 * @param cls the `struct GNUNET_PEERINFO_Handle *` (with the queue)
334 * @param size size of the buffer (0 on error) 337 * @param size size of @a buf (0 on error)
335 * @param buf where to copy the message 338 * @param buf where to copy the message
336 * @return number of bytes copied to buf 339 * @return number of bytes copied to @a buf
337 */ 340 */
338static size_t 341static size_t
339do_transmit (void *cls, size_t size, void *buf) 342do_transmit (void *cls,
343 size_t size,
344 void *buf)
340{ 345{
341 struct GNUNET_PEERINFO_Handle *h = cls; 346 struct GNUNET_PEERINFO_Handle *h = cls;
342 struct GNUNET_PEERINFO_AddContext *ac = h->ac_head; 347 struct GNUNET_PEERINFO_AddContext *ac = h->ac_head;
@@ -349,11 +354,13 @@ do_transmit (void *cls, size_t size, void *buf)
349 { 354 {
350 /* peerinfo service died */ 355 /* peerinfo service died */
351 LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 356 LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
352 "Failed to transmit message to `%s' service.\n", "PEERINFO"); 357 "Failed to transmit message to `%s' service.\n",
358 "PEERINFO");
353 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); 359 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac);
354 reconnect (h); 360 reconnect (h);
355 if (NULL != ac->cont) 361 if (NULL != ac->cont)
356 ac->cont (ac->cont_cls, _("failed to transmit request (service down?)")); 362 ac->cont (ac->cont_cls,
363 _("failed to transmit request (service down?)"));
357 GNUNET_free (ac); 364 GNUNET_free (ac);
358 return 0; 365 return 0;
359 } 366 }
@@ -365,7 +372,9 @@ do_transmit (void *cls, size_t size, void *buf)
365 return 0; 372 return 0;
366 } 373 }
367 LOG (GNUNET_ERROR_TYPE_DEBUG, 374 LOG (GNUNET_ERROR_TYPE_DEBUG,
368 "Transmitting request of size %u to `%s' service.\n", ret, "PEERINFO"); 375 "Transmitting request of size %u to `%s' service.\n",
376 ret,
377 "PEERINFO");
369 memcpy (buf, &ac[1], ret); 378 memcpy (buf, &ac[1], ret);
370 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); 379 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac);
371 trigger_transmit (h); 380 trigger_transmit (h);
@@ -398,7 +407,8 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h)
398 return; 407 return;
399 } 408 }
400 h->th = 409 h->th =
401 GNUNET_CLIENT_notify_transmit_ready (h->client, ac->size, 410 GNUNET_CLIENT_notify_transmit_ready (h->client,
411 ac->size,
402 GNUNET_TIME_UNIT_FOREVER_REL, 412 GNUNET_TIME_UNIT_FOREVER_REL,
403 GNUNET_YES, 413 GNUNET_YES,
404 &do_transmit, h); 414 &do_transmit, h);
@@ -408,7 +418,7 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h)
408/** 418/**
409 * Add a host to the persistent list. This method operates in 419 * Add a host to the persistent list. This method operates in
410 * semi-reliable mode: if the transmission is not completed by 420 * semi-reliable mode: if the transmission is not completed by
411 * the time 'GNUNET_PEERINFO_disconnect' is called, it will be 421 * the time #GNUNET_PEERINFO_disconnect() is called, it will be
412 * aborted. Furthermore, if a second HELLO is added for the 422 * aborted. Furthermore, if a second HELLO is added for the
413 * same peer before the first one was transmitted, PEERINFO may 423 * same peer before the first one was transmitted, PEERINFO may
414 * merge the two HELLOs prior to transmission to the service. 424 * merge the two HELLOs prior to transmission to the service.
@@ -416,7 +426,7 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h)
416 * @param h handle to the peerinfo service 426 * @param h handle to the peerinfo service
417 * @param hello the verified (!) HELLO message 427 * @param hello the verified (!) HELLO message
418 * @param cont continuation to call when done, NULL is allowed 428 * @param cont continuation to call when done, NULL is allowed
419 * @param cont_cls closure for 'cont' 429 * @param cont_cls closure for @a cont
420 * @return handle to cancel add operation; all pending 430 * @return handle to cancel add operation; all pending
421 * 'add' operations will be cancelled automatically 431 * 'add' operations will be cancelled automatically
422 * on disconnect, so it is not necessary to keep this 432 * on disconnect, so it is not necessary to keep this
@@ -436,7 +446,9 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
436 GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer)); 446 GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer));
437 LOG (GNUNET_ERROR_TYPE_DEBUG, 447 LOG (GNUNET_ERROR_TYPE_DEBUG,
438 "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n", 448 "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n",
439 GNUNET_i2s (&peer), hs, "HELLO"); 449 GNUNET_i2s (&peer),
450 hs,
451 "HELLO");
440 ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs); 452 ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs);
441 ac->h = h; 453 ac->h = h;
442 ac->size = hs; 454 ac->size = hs;
@@ -451,7 +463,7 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
451 463
452/** 464/**
453 * Cancel pending 'add' operation. Must only be called before 465 * Cancel pending 'add' operation. Must only be called before
454 * either 'cont' or 'GNUNET_PEERINFO_disconnect' are invoked. 466 * either 'cont' or #GNUNET_PEERINFO_disconnect() are invoked.
455 * 467 *
456 * @param ac handle for the add operation to cancel 468 * @param ac handle for the add operation to cancel
457 */ 469 */
@@ -475,7 +487,8 @@ GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac)
475 * @param msg message received, NULL on timeout or fatal error 487 * @param msg message received, NULL on timeout or fatal error
476 */ 488 */
477static void 489static void
478peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) 490peerinfo_handler (void *cls,
491 const struct GNUNET_MessageHeader *msg)
479{ 492{
480 struct GNUNET_PEERINFO_Handle *h = cls; 493 struct GNUNET_PEERINFO_Handle *h = cls;
481 struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head; 494 struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head;
@@ -519,14 +532,17 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
519 { 532 {
520 /* normal end of list of peers, signal end, process next pending request */ 533 /* normal end of list of peers, signal end, process next pending request */
521 LOG (GNUNET_ERROR_TYPE_DEBUG, 534 LOG (GNUNET_ERROR_TYPE_DEBUG,
522 "Received end of list of peers from `%s' service\n", "PEERINFO"); 535 "Received end of list of peers from `%s' service\n",
536 "PEERINFO");
523 GNUNET_PEERINFO_iterate_cancel (ic); 537 GNUNET_PEERINFO_iterate_cancel (ic);
524 trigger_transmit (h); 538 trigger_transmit (h);
525 if ( (GNUNET_NO == h->in_receive) && 539 if ( (GNUNET_NO == h->in_receive) &&
526 (NULL != h->ic_head) ) 540 (NULL != h->ic_head) )
527 { 541 {
528 h->in_receive = GNUNET_YES; 542 h->in_receive = GNUNET_YES;
529 GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h, 543 GNUNET_CLIENT_receive (h->client,
544 &peerinfo_handler,
545 h,
530 GNUNET_TIME_absolute_get_remaining (h->ic_head->timeout)); 546 GNUNET_TIME_absolute_get_remaining (h->ic_head->timeout));
531 } 547 }
532 if (NULL != cb) 548 if (NULL != cb)
@@ -550,7 +566,9 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
550 im = (const struct InfoMessage *) msg; 566 im = (const struct InfoMessage *) msg;
551 GNUNET_break (0 == ntohl (im->reserved)); 567 GNUNET_break (0 == ntohl (im->reserved));
552 if ( (GNUNET_YES == ic->have_peer) && 568 if ( (GNUNET_YES == ic->have_peer) &&
553 (0 != memcmp (&ic->peer, &im->peer, sizeof (struct GNUNET_PeerIdentity))) ) 569 (0 != memcmp (&ic->peer,
570 &im->peer,
571 sizeof (struct GNUNET_PeerIdentity))) )
554 { 572 {
555 /* bogus message (from a different iteration call?); out of sequence! */ 573 /* bogus message (from a different iteration call?); out of sequence! */
556 LOG (GNUNET_ERROR_TYPE_ERROR, 574 LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -562,7 +580,9 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
562 GNUNET_PEERINFO_iterate_cancel (ic); 580 GNUNET_PEERINFO_iterate_cancel (ic);
563 reconnect (h); 581 reconnect (h);
564 if (NULL != cb) 582 if (NULL != cb)
565 cb (cb_cls, NULL, NULL, 583 cb (cb_cls,
584 NULL,
585 NULL,
566 _("Received invalid message from `PEERINFO' service.")); 586 _("Received invalid message from `PEERINFO' service."));
567 return; 587 return;
568 } 588 }
@@ -577,7 +597,9 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
577 GNUNET_PEERINFO_iterate_cancel (ic); 597 GNUNET_PEERINFO_iterate_cancel (ic);
578 reconnect (h); 598 reconnect (h);
579 if (NULL != cb) 599 if (NULL != cb)
580 cb (cb_cls, NULL, NULL, 600 cb (cb_cls,
601 NULL,
602 NULL,
581 _("Received invalid message from `PEERINFO' service.")); 603 _("Received invalid message from `PEERINFO' service."));
582 return; 604 return;
583 } 605 }
@@ -588,18 +610,24 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
588 GNUNET_PEERINFO_iterate_cancel (ic); 610 GNUNET_PEERINFO_iterate_cancel (ic);
589 reconnect (h); 611 reconnect (h);
590 if (NULL != cb) 612 if (NULL != cb)
591 cb (cb_cls, NULL, NULL, 613 cb (cb_cls,
614 NULL,
615 NULL,
592 _("Received invalid message from `PEERINFO' service.")); 616 _("Received invalid message from `PEERINFO' service."));
593 return; 617 return;
594 } 618 }
595 if (0 != memcmp (&im->peer, &id, sizeof (struct GNUNET_PeerIdentity))) 619 if (0 != memcmp (&im->peer,
620 &id,
621 sizeof (struct GNUNET_PeerIdentity)))
596 { 622 {
597 /* malformed message */ 623 /* malformed message */
598 GNUNET_break (0); 624 GNUNET_break (0);
599 GNUNET_PEERINFO_iterate_cancel (ic); 625 GNUNET_PEERINFO_iterate_cancel (ic);
600 reconnect (h); 626 reconnect (h);
601 if (NULL != cb) 627 if (NULL != cb)
602 cb (cb_cls, NULL, NULL, 628 cb (cb_cls,
629 NULL,
630 NULL,
603 _("Received invalid message from `PEERINFO' service.")); 631 _("Received invalid message from `PEERINFO' service."));
604 return; 632 return;
605 } 633 }
@@ -608,13 +636,20 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
608 /* normal data message */ 636 /* normal data message */
609 LOG (GNUNET_ERROR_TYPE_DEBUG, 637 LOG (GNUNET_ERROR_TYPE_DEBUG,
610 "Received %u bytes of `%s' information about peer `%s' from `%s' service\n", 638 "Received %u bytes of `%s' information about peer `%s' from `%s' service\n",
611 (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello), "HELLO", 639 (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello),
612 GNUNET_i2s (&im->peer), "PEERINFO"); 640 "HELLO",
641 GNUNET_i2s (&im->peer),
642 "PEERINFO");
613 h->in_receive = GNUNET_YES; 643 h->in_receive = GNUNET_YES;
614 GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h, 644 GNUNET_CLIENT_receive (h->client,
645 &peerinfo_handler,
646 h,
615 GNUNET_TIME_absolute_get_remaining (ic->timeout)); 647 GNUNET_TIME_absolute_get_remaining (ic->timeout));
616 if (NULL != cb) 648 if (NULL != cb)
617 cb (cb_cls, &im->peer, hello, NULL); 649 cb (cb_cls,
650 &im->peer,
651 hello,
652 NULL);
618} 653}
619 654
620 655
@@ -622,11 +657,12 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
622 * We've transmitted the iteration request. Now get ready to process 657 * We've transmitted the iteration request. Now get ready to process
623 * the results (or handle transmission error). 658 * the results (or handle transmission error).
624 * 659 *
625 * @param cls the 'struct GNUNET_PEERINFO_IteratorContext' 660 * @param cls the `struct GNUNET_PEERINFO_IteratorContext *`
626 * @param emsg error message, NULL if transmission worked 661 * @param emsg error message, NULL if transmission worked
627 */ 662 */
628static void 663static void
629iterator_start_receive (void *cls, const char *emsg) 664iterator_start_receive (void *cls,
665 const char *emsg)
630{ 666{
631 struct GNUNET_PEERINFO_IteratorContext *ic = cls; 667 struct GNUNET_PEERINFO_IteratorContext *ic = cls;
632 struct GNUNET_PEERINFO_Handle *h = ic->h; 668 struct GNUNET_PEERINFO_Handle *h = ic->h;
@@ -644,13 +680,16 @@ iterator_start_receive (void *cls, const char *emsg)
644 cb (cb_cls, NULL, NULL, emsg); 680 cb (cb_cls, NULL, NULL, emsg);
645 return; 681 return;
646 } 682 }
647 LOG (GNUNET_ERROR_TYPE_DEBUG, "Waiting for response from `%s' service.\n", 683 LOG (GNUNET_ERROR_TYPE_DEBUG,
684 "Waiting for response from `%s' service.\n",
648 "PEERINFO"); 685 "PEERINFO");
649 ic->request_transmitted = GNUNET_YES; 686 ic->request_transmitted = GNUNET_YES;
650 if (GNUNET_NO == h->in_receive) 687 if (GNUNET_NO == h->in_receive)
651 { 688 {
652 h->in_receive = GNUNET_YES; 689 h->in_receive = GNUNET_YES;
653 GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h, 690 GNUNET_CLIENT_receive (h->client,
691 &peerinfo_handler,
692 h,
654 GNUNET_TIME_absolute_get_remaining (ic->timeout)); 693 GNUNET_TIME_absolute_get_remaining (ic->timeout));
655 } 694 }
656} 695}
@@ -659,11 +698,12 @@ iterator_start_receive (void *cls, const char *emsg)
659/** 698/**
660 * Peerinfo iteration request has timed out. 699 * Peerinfo iteration request has timed out.
661 * 700 *
662 * @param cls the 'struct GNUNET_PEERINFO_IteratorContext*' 701 * @param cls the `struct GNUNET_PEERINFO_IteratorContext *`
663 * @param tc scheduler context 702 * @param tc scheduler context
664 */ 703 */
665static void 704static void
666signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 705signal_timeout (void *cls,
706 const struct GNUNET_SCHEDULER_TaskContext *tc)
667{ 707{
668 struct GNUNET_PEERINFO_IteratorContext *ic = cls; 708 struct GNUNET_PEERINFO_IteratorContext *ic = cls;
669 GNUNET_PEERINFO_Processor cb; 709 GNUNET_PEERINFO_Processor cb;
@@ -674,7 +714,9 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
674 cb_cls = ic->callback_cls; 714 cb_cls = ic->callback_cls;
675 GNUNET_PEERINFO_iterate_cancel (ic); 715 GNUNET_PEERINFO_iterate_cancel (ic);
676 if (NULL != cb) 716 if (NULL != cb)
677 cb (cb_cls, NULL, NULL, 717 cb (cb_cls,
718 NULL,
719 NULL,
678 _("Timeout transmitting iteration request to `PEERINFO' service.")); 720 _("Timeout transmitting iteration request to `PEERINFO' service."));
679} 721}
680 722
@@ -685,23 +727,24 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
685 * with a NULL pointer. After that final invocation, the iterator 727 * with a NULL pointer. After that final invocation, the iterator
686 * context must no longer be used. 728 * context must no longer be used.
687 * 729 *
688 * Instead of calling this function with 'peer == NULL' it is often 730 * Instead of calling this function with `peer == NULL` it is often
689 * better to use 'GNUNET_PEERINFO_notify'. 731 * better to use #GNUNET_PEERINFO_notify().
690 * 732 *
691 * @param h handle to the peerinfo service 733 * @param h handle to the peerinfo service
692 * @param include_friend_only include HELLO messages for friends only 734 * @param include_friend_only include HELLO messages for friends only
693 * @param peer restrict iteration to this peer only (can be NULL) 735 * @param peer restrict iteration to this peer only (can be NULL)
694 * @param timeout how long to wait until timing out 736 * @param timeout how long to wait until timing out
695 * @param callback the method to call for each peer 737 * @param callback the method to call for each peer
696 * @param callback_cls closure for callback 738 * @param callback_cls closure for @a callback
697 * @return iterator context 739 * @return iterator context
698 */ 740 */
699struct GNUNET_PEERINFO_IteratorContext * 741struct GNUNET_PEERINFO_IteratorContext *
700GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, 742GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
701 int include_friend_only, 743 int include_friend_only,
702 const struct GNUNET_PeerIdentity *peer, 744 const struct GNUNET_PeerIdentity *peer,
703 struct GNUNET_TIME_Relative timeout, 745 struct GNUNET_TIME_Relative timeout,
704 GNUNET_PEERINFO_Processor callback, void *callback_cls) 746 GNUNET_PEERINFO_Processor callback,
747 void *callback_cls)
705{ 748{
706 struct ListAllPeersMessage *lapm; 749 struct ListAllPeersMessage *lapm;
707 struct ListPeerMessage *lpm; 750 struct ListPeerMessage *lpm;
@@ -781,7 +824,9 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic)
781 ic); 824 ic);
782 if (NULL != ic->ac) 825 if (NULL != ic->ac)
783 { 826 {
784 GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ic->ac); 827 GNUNET_CONTAINER_DLL_remove (h->ac_head,
828 h->ac_tail,
829 ic->ac);
785 GNUNET_free (ic->ac); 830 GNUNET_free (ic->ac);
786 } 831 }
787 GNUNET_free (ic); 832 GNUNET_free (ic);