- rem = GREYLIST_AFTER_ATTEMPT;
- rem = GNUNET_TIME_relative_multiply (rem, connection_count);
- rem = GNUNET_TIME_relative_divide (rem, target_connection_count);
- if (pos->connect_attempts > 30)
- pos->connect_attempts = 30;
- rem = GNUNET_TIME_relative_multiply (rem, 1 << (++pos->connect_attempts));
- rem = GNUNET_TIME_relative_max (rem, GREYLIST_AFTER_ATTEMPT_MIN);
- rem = GNUNET_TIME_relative_min (rem, GREYLIST_AFTER_ATTEMPT_MAX);
- pos->greylisted_until = GNUNET_TIME_relative_to_absolute (rem);
- if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (pos->greylist_clean_task);
- pos->greylist_clean_task =
- GNUNET_SCHEDULER_add_delayed (rem, &remove_from_greylist, pos);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to connect to `%s'\n",
- GNUNET_i2s (&pos->pid));
- GNUNET_STATISTICS_update (stats,
- gettext_noop
- ("# connect requests issued to transport"), 1,
- GNUNET_NO);
- GNUNET_TRANSPORT_try_connect (transport, &pos->pid);
-}
-
-
-/**
- * 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)
-{
- struct Peer *pos = cls;
- struct GNUNET_TIME_Relative rem;
-
- pos->greylist_clean_task = GNUNET_SCHEDULER_NO_TASK;
- rem = GNUNET_TIME_absolute_get_remaining (pos->greylisted_until);
- if (rem.rel_value == 0)