av->excess_task = NULL;
if (NULL != av->excess_cb)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Notifying application about excess bandwidth\n");
av->excess_cb (av->excess_cb_cls);
+ }
}
}
else
{
- delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
- left_bytes);
- delay = GNUNET_TIME_relative_divide (delay,
- av->available_bytes_per_s__);
+ double factor = 1.0 * left_bytes / (double) av->available_bytes_per_s__;
+ delay = GNUNET_TIME_relative_saturating_multiply (GNUNET_TIME_UNIT_SECONDS,
+ (unsigned long long) factor);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %llu bps it will take us %s for %lld bytes to reach excess threshold\n",