+/**
+ * Free all resources associated with the given peer.
+ *
+ * @param cls closure (not used)
+ * @param pid identity of the peer
+ * @param value peer to free
+ * @return GNUNET_YES (always: continue to iterate)
+ */
+static int
+free_peer (void *cls,
+ const GNUNET_HashCode *pid,
+ void *value)
+{
+ struct Peer *pos = value;
+
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (peers,
+ pid,
+ pos));
+ if (pos->hello_req != NULL)
+ GNUNET_CORE_notify_transmit_ready_cancel (pos->hello_req);
+ if (pos->connect_req != NULL)
+ GNUNET_CORE_peer_request_connect_cancel (pos->connect_req);
+ if (pos->hello_delay_task != GNUNET_SCHEDULER_NO_TASK)
+ GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
+ if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK)
+ GNUNET_SCHEDULER_cancel (pos->greylist_clean_task);
+ GNUNET_free_non_null (pos->hello);
+ if (pos->filter != NULL)
+ GNUNET_CONTAINER_bloomfilter_free (pos->filter);
+ GNUNET_free (pos);
+ return GNUNET_YES;
+}
+
+
+/**
+ * Discard peer entries for greylisted peers
+ * where the greylisting has expired.
+ *
+ * @param cls 'struct Peer' to greylist
+ * @param tc scheduler context
+ */
+static void
+remove_from_greylist (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc);
+
+