+ * @param cls the 'struct GNUNET_PEERINFO_IteratorContext'
+ * @param transmit_success GNUNET_OK if transmission worked
+ */
+static void
+iterator_start_receive (void *cls,
+ int transmit_success)
+{
+ struct GNUNET_PEERINFO_IteratorContext *ic = cls;
+
+ if (GNUNET_OK != transmit_success)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Failed to transmit iteration request to `%s' service (%d).\n"),
+ "PEERINFO",
+ transmit_success);
+ if (ic->timeout_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (ic->timeout_task);
+ ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ reconnect (ic->h);
+ trigger_transmit (ic->h);
+ if (ic->callback != NULL)
+ ic->callback (ic->callback_cls, NULL, NULL);
+ GNUNET_free (ic);
+ return;
+ }
+#if DEBUG_PEERINFO
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Waiting for response from `%s' service.\n",
+ "PEERINFO");
+#endif
+ ic->h->in_receive = GNUNET_YES;
+ ic->in_receive = GNUNET_YES;
+ ic->tqe = NULL;
+ GNUNET_CLIENT_receive (ic->h->client,
+ &peerinfo_handler,
+ ic,
+ 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_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
+ _("Timeout transmitting iteration request to `%s' service.\n"),
+ "PEERINFO");
+ ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ if (! ic->in_receive)
+ GNUNET_CONTAINER_DLL_remove (ic->h->tq_head,
+ ic->h->tq_tail,
+ ic->tqe);
+ reconnect (ic->h);
+ ic->callback (ic->callback_cls, NULL, NULL);
+ ic->callback = NULL;
+ GNUNET_free_non_null (ic->tqe);
+ GNUNET_free (ic);
+}
+
+
+/**
+ * Call a method for each known matching host and change its trust
+ * value. 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