diff options
author | lurchi <lurchi@strangeplace.net> | 2018-01-22 18:43:47 +0100 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2018-01-22 18:43:47 +0100 |
commit | 65239e99fa514c062995b34c961ba7cb010c1b62 (patch) | |
tree | 307efc49f82e8656c85cbe6a3b46925f89362eb4 /src/util/scheduler.c | |
parent | b8810222ee74c1216b18da9749522710c155c9be (diff) | |
download | gnunet-65239e99fa514c062995b34c961ba7cb010c1b62.tar.gz gnunet-65239e99fa514c062995b34c961ba7cb010c1b62.zip |
use absolute times in driver
this shouldn't change anything but makes debugging easier.
Diffstat (limited to 'src/util/scheduler.c')
-rw-r--r-- | src/util/scheduler.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 6cf5e1168..2970d3c25 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -254,10 +254,10 @@ struct DriverContext | |||
254 | struct Scheduled *scheduled_tail; | 254 | struct Scheduled *scheduled_tail; |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * the time until the select driver will wake up again (after | 257 | * the time when the select driver will wake up again (after |
258 | * calling select) | 258 | * calling select) |
259 | */ | 259 | */ |
260 | struct GNUNET_TIME_Relative timeout; | 260 | struct GNUNET_TIME_Absolute timeout; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | 263 | ||
@@ -678,7 +678,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, | |||
678 | struct GNUNET_SCHEDULER_Driver *driver; | 678 | struct GNUNET_SCHEDULER_Driver *driver; |
679 | struct DriverContext context = {.scheduled_head = NULL, | 679 | struct DriverContext context = {.scheduled_head = NULL, |
680 | .scheduled_tail = NULL, | 680 | .scheduled_tail = NULL, |
681 | .timeout = GNUNET_TIME_UNIT_FOREVER_REL}; | 681 | .timeout = GNUNET_TIME_UNIT_FOREVER_ABS}; |
682 | 682 | ||
683 | driver = GNUNET_SCHEDULER_driver_select (); | 683 | driver = GNUNET_SCHEDULER_driver_select (); |
684 | driver->cls = &context; | 684 | driver->cls = &context; |
@@ -2239,11 +2239,11 @@ select_loop (void *cls, | |||
2239 | ws = GNUNET_NETWORK_fdset_create (); | 2239 | ws = GNUNET_NETWORK_fdset_create (); |
2240 | tasks_ready = GNUNET_NO; | 2240 | tasks_ready = GNUNET_NO; |
2241 | while (NULL != context->scheduled_head || | 2241 | while (NULL != context->scheduled_head || |
2242 | GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != context->timeout.rel_value_us) | 2242 | GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != context->timeout.abs_value_us) |
2243 | { | 2243 | { |
2244 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2244 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2245 | "select timeout = %s\n", | 2245 | "select timeout = %s\n", |
2246 | GNUNET_STRINGS_relative_time_to_string (context->timeout, GNUNET_NO)); | 2246 | GNUNET_STRINGS_absolute_time_to_string (context->timeout)); |
2247 | 2247 | ||
2248 | GNUNET_NETWORK_fdset_zero (rs); | 2248 | GNUNET_NETWORK_fdset_zero (rs); |
2249 | GNUNET_NETWORK_fdset_zero (ws); | 2249 | GNUNET_NETWORK_fdset_zero (ws); |
@@ -2259,12 +2259,14 @@ select_loop (void *cls, | |||
2259 | GNUNET_NETWORK_fdset_set_native (ws, pos->fdi->sock); | 2259 | GNUNET_NETWORK_fdset_set_native (ws, pos->fdi->sock); |
2260 | } | 2260 | } |
2261 | } | 2261 | } |
2262 | struct GNUNET_TIME_Relative time_remaining = | ||
2263 | GNUNET_TIME_absolute_get_remaining (context->timeout); | ||
2262 | if (NULL == scheduler_select) | 2264 | if (NULL == scheduler_select) |
2263 | { | 2265 | { |
2264 | select_result = GNUNET_NETWORK_socket_select (rs, | 2266 | select_result = GNUNET_NETWORK_socket_select (rs, |
2265 | ws, | 2267 | ws, |
2266 | NULL, | 2268 | NULL, |
2267 | context->timeout); | 2269 | time_remaining); |
2268 | } | 2270 | } |
2269 | else | 2271 | else |
2270 | { | 2272 | { |
@@ -2272,7 +2274,7 @@ select_loop (void *cls, | |||
2272 | rs, | 2274 | rs, |
2273 | ws, | 2275 | ws, |
2274 | NULL, | 2276 | NULL, |
2275 | context->timeout); | 2277 | time_remaining); |
2276 | } | 2278 | } |
2277 | if (select_result == GNUNET_SYSERR) | 2279 | if (select_result == GNUNET_SYSERR) |
2278 | { | 2280 | { |
@@ -2347,9 +2349,9 @@ select_set_wakeup (void *cls, | |||
2347 | struct GNUNET_TIME_Absolute dt) | 2349 | struct GNUNET_TIME_Absolute dt) |
2348 | { | 2350 | { |
2349 | struct DriverContext *context = cls; | 2351 | struct DriverContext *context = cls; |
2352 | |||
2350 | GNUNET_assert (NULL != context); | 2353 | GNUNET_assert (NULL != context); |
2351 | 2354 | context->timeout = dt; | |
2352 | context->timeout = GNUNET_TIME_absolute_get_remaining (dt); | ||
2353 | } | 2355 | } |
2354 | 2356 | ||
2355 | 2357 | ||