- pos->connect_attempts ++;
- 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);
-
- pos->next_connect_attempt = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(),
- GNUNET_TIME_relative_multiply (MAX_CONNECT_FREQUENCY_DELAY, pos->connect_attempts));
- pos->next_connect_attempt = GNUNET_TIME_absolute_min (pos->next_connect_attempt,
- GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), MIN_CONNECT_FREQUENCY_DELAY));
-
- if (pos->greylist_clean_task != NULL)
- 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, NULL, NULL);
-}
-
-
-/**
- * Try to connect to the specified peer.
- *
- * @param cls peer to connect to
- * @param tc scheduler context
- */
-static void
-do_attempt_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct Peer *pos = cls;
- struct GNUNET_TIME_Relative delay;
-
- pos->attempt_connect_task = NULL;
- if (GNUNET_YES == pos->is_connected)
- return;
-
- /* Try next connection attempt, when:
- * - topology allows the next transport connection attempt
- * and
- * - the next connection event for this peer is allowed
- */
- delay = GNUNET_TIME_relative_max (GNUNET_TIME_absolute_get_remaining (next_connect_attempt),
- GNUNET_TIME_absolute_get_remaining (pos->next_connect_attempt));
-
- if (delay.rel_value_us > 0)