+ * @param cls the 'struct GNUNET_PEERINFO_IteratorContext'
+ * @param emsg error message, NULL if transmission worked
+ */
+static void
+iterator_start_receive (void *cls, const char *emsg)
+{
+ struct GNUNET_PEERINFO_IteratorContext *ic = cls;
+ struct GNUNET_PEERINFO_Handle *h = ic->h;
+ GNUNET_PEERINFO_Processor cb;
+ void *cb_cls;
+
+ ic->ac = NULL;
+ if (NULL != emsg)
+ {
+ cb = ic->callback;
+ cb_cls = ic->callback_cls;
+ GNUNET_PEERINFO_iterate_cancel (ic);
+ reconnect (h);
+ if (NULL != cb)
+ cb (cb_cls, NULL, NULL, emsg);
+ return;
+ }
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Waiting for response from `%s' service.\n",
+ "PEERINFO");
+ ic->request_transmitted = GNUNET_YES;
+ if (GNUNET_NO == h->in_receive)
+ {
+ h->in_receive = GNUNET_YES;
+ GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h,
+ GNUNET_TIME_absolute_get_remaining (ic->timeout));
+ }
+}
+
+
+/**
+ * Peerinfo iteration request has timed out.
+ *
+ * @param cls the 'struct GNUNET_PEERINFO_IteratorContext*'
+ * @param tc scheduler context
+ */
+static void
+signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct GNUNET_PEERINFO_IteratorContext *ic = cls;
+ GNUNET_PEERINFO_Processor cb;
+ void *cb_cls;
+
+ ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ cb = ic->callback;
+ cb_cls = ic->callback_cls;
+ GNUNET_PEERINFO_iterate_cancel (ic);
+ if (NULL != cb)
+ cb (cb_cls, NULL, NULL,
+ _("Timeout transmitting iteration request to `PEERINFO' service."));
+}
+
+
+/**
+ * Call a method for each known matching host. The callback method
+ * will be invoked once for each matching host and then finally once
+ * with a NULL pointer. After that final invocation, the iterator
+ * context must no longer be used.
+ *
+ * Instead of calling this function with 'peer == NULL' it is often
+ * better to use 'GNUNET_PEERINFO_notify'.
+ *
+ * @param h handle to the peerinfo service
+ * @param include_friend_only include HELLO messages for friends only