+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Received an error notification from MQ of type: %d\n"), error);
+ reconnect (h);
+}
+
+
+/**
+ * Iterator over previous watches to resend them
+ *
+ * @param cls the `struct GNUNET_PEERSTORE_Handle`
+ * @param key key for the watch
+ * @param value the `struct GNUNET_PEERSTORE_WatchContext *`
+ * @return #GNUNET_YES (continue to iterate)
+ */
+static int
+rewatch_it (void *cls, const struct GNUNET_HashCode *key, void *value)
+{
+ struct GNUNET_PEERSTORE_Handle *h = cls;
+ struct GNUNET_PEERSTORE_WatchContext *wc = value;
+ struct StoreKeyHashMessage *hm;
+ struct GNUNET_MQ_Envelope *ev;
+
+ ev = GNUNET_MQ_msg (hm, GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH);
+ hm->keyhash = wc->keyhash;
+ GNUNET_MQ_send (h->mq, ev);
+ return GNUNET_YES;
+}
+
+
+/**
+ * Called when the iterate request is timedout
+ *
+ * @param cls a `struct GNUNET_PEERSTORE_IterateContext *`
+ * @param tc Scheduler task context (unused)
+ */
+static void
+iterate_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct GNUNET_PEERSTORE_IterateContext *ic = cls;
+ GNUNET_PEERSTORE_Processor callback;
+ void *callback_cls;
+
+ ic->timeout_task = NULL;
+ callback = ic->callback;
+ callback_cls = ic->callback_cls;
+ GNUNET_PEERSTORE_iterate_cancel (ic);
+ if (NULL != callback)
+ callback (callback_cls, NULL, _("timeout"));