- * @param cls our 'struct DisconnectList'
- * @param tc unused
- */
-static void
-disconnect_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct DisconnectList *dl = cls;
-
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# peers blacklisted"),
- 1,
- GNUNET_NO);
- GNUNET_CONTAINER_DLL_remove (disconnect_head,
- disconnect_tail,
- dl);
- GNUNET_free (dl);
-}
-
-
-/**
- * Force a disconnect from the specified peer.
- *
- * @param pl peer to disconnect
- */
-static void
-force_disconnect (struct Peer *pl)
-{
- const struct GNUNET_PeerIdentity *peer = &pl->pid;
- struct DisconnectList *dl;
-
- if (NULL != pl->wh)
- {
- GNUNET_TRANSPORT_blacklist_cancel (pl->wh);
- pl->wh = NULL;
- }
- pl->is_blocked = GNUNET_YES;
- dl = GNUNET_malloc (sizeof (struct DisconnectList));
- dl->peer = *peer;
- GNUNET_CONTAINER_DLL_insert (disconnect_head,
- disconnect_tail,
- dl);
- dl->rh = GNUNET_TRANSPORT_blacklist (sched, cfg,
- peer,
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &disconnect_done,
- dl);
-}
-
-
-
-/**
- * Function called once our request to 'whitelist' a peer
- * has completed.
- *
- * @param cls our 'struct Peer'
- * @param tc unused
- */
-static void
-whitelist_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct Peer *pl = cls;
-
- pl->wh = NULL;
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# peers blacklisted"),
- -1,
- GNUNET_NO);
-}
-
-
-/**
- * Whitelist the given peer (if it was blacklisted before).
- *
- * @param cls closure (not used)
- * @param pid identity of the peer
- * @param value peer to free
- * @return GNUNET_YES (always: continue to iterate)