_("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"),
"select");
}
- tv.tv_sec = timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us;
- tv.tv_usec =
- (timeout.rel_value_us -
- (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us));
+ if (timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us > (unsigned long long) LONG_MAX)
+ {
+ tv.tv_sec = LONG_MAX;
+ tv.tv_usec = 999999L;
+ }
+ else
+ {
+ tv.tv_sec = (long) (timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us);
+ tv.tv_usec =
+ (timeout.rel_value_us -
+ (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us));
+ }
return select (nfds,
(NULL != rfds) ? &rfds->sds : NULL,
(NULL != wfds) ? &wfds->sds : NULL,
* Argument to be passed from the driver to
* #GNUNET_SCHEDULER_run_from_driver(). Contains the
* scheduler's internal state.
- */
+ */
struct GNUNET_SCHEDULER_Handle
{
/**
* Driver we used for the event loop.
*/
const struct GNUNET_SCHEDULER_Driver *driver;
-
+
};
* Handle to the scheduler's state.
*/
const struct GNUNET_SCHEDULER_Handle *sh;
-
+
/**
* Set of file descriptors this task is waiting
* for for reading. Once ready, this is updated
* Size of the @e fds array.
*/
unsigned int fds_len;
-
+
/**
* Why is the task ready? Set after task is added to ready queue.
* Initially set to zero. All reasons that have already been
struct GNUNET_SCHEDULER_Task *pos;
struct GNUNET_SCHEDULER_Task *prev;
+ if (at.abs_value_us > UINT64_MAX / 10)
+ {
+ GNUNET_assert (0);
+ }
GNUNET_assert (NULL != active_task);
GNUNET_assert (NULL != task);
t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
*
* @param sh scheduler handle that was given to the `loop`
* @return #GNUNET_OK if there are more tasks that are ready,
- * and thus we would like to run more (yield to avoid
+ * and thus we would like to run more (yield to avoid
* blocking other activities for too long)
* #GNUNET_NO if we are done running tasks (yield to block)
* #GNUNET_SYSERR on error
pending_timeout_last = NULL;
queue_ready_task (pos);
}
-
+
if (0 == ready_count)
return GNUNET_NO;
- /* find out which task priority level we are going to
+ /* find out which task priority level we are going to
process this time */
max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP;
GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]);