diff options
author | lurchi <lurchi@strangeplace.net> | 2017-08-05 16:31:09 +0200 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2017-08-05 16:31:09 +0200 |
commit | b60af34ef8ec413af4eea572ce211ab03a79ca17 (patch) | |
tree | 75d37afeecfed8eccaec6e761e7e36cefaf4a2dd /src | |
parent | 290af4d573924059c0492eacb8a5e67a849d94d6 (diff) | |
download | gnunet-b60af34ef8ec413af4eea572ce211ab03a79ca17.tar.gz gnunet-b60af34ef8ec413af4eea572ce211ab03a79ca17.zip |
fix segfault and pending_timeout logic
Diffstat (limited to 'src')
-rw-r--r-- | src/util/scheduler.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 3da4eaddb..42309c199 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -536,10 +536,11 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs, | |||
536 | pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; | 536 | pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; |
537 | if (0 == pos->reason) | 537 | if (0 == pos->reason) |
538 | break; | 538 | break; |
539 | scheduler_driver->set_wakeup (scheduler_driver->cls, | ||
540 | pending_timeout_head->timeout); | ||
539 | GNUNET_CONTAINER_DLL_remove (pending_timeout_head, | 541 | GNUNET_CONTAINER_DLL_remove (pending_timeout_head, |
540 | pending_timeout_tail, | 542 | pending_timeout_tail, |
541 | pos); | 543 | pos); |
542 | scheduler_driver->set_wakeup(scheduler_driver->cls,pending_timeout_head->timeout); | ||
543 | if (pending_timeout_last == pos) | 544 | if (pending_timeout_last == pos) |
544 | pending_timeout_last = NULL; | 545 | pending_timeout_last = NULL; |
545 | queue_ready_task (pos); | 546 | queue_ready_task (pos); |
@@ -1065,14 +1066,20 @@ GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task) | |||
1065 | (NULL == task->write_set) ) | 1066 | (NULL == task->write_set) ) |
1066 | { | 1067 | { |
1067 | if (GNUNET_YES == task->on_shutdown) | 1068 | if (GNUNET_YES == task->on_shutdown) |
1068 | GNUNET_CONTAINER_DLL_remove (shutdown_head, | 1069 | GNUNET_CONTAINER_DLL_remove (shutdown_head, |
1069 | shutdown_tail, | 1070 | shutdown_tail, |
1070 | task); | 1071 | task); |
1071 | else | 1072 | else |
1072 | GNUNET_CONTAINER_DLL_remove (pending_timeout_head, | 1073 | { |
1073 | pending_timeout_tail, | 1074 | GNUNET_CONTAINER_DLL_remove (pending_timeout_head, |
1074 | task); | 1075 | pending_timeout_tail, |
1075 | scheduler_driver->set_wakeup(scheduler_driver->cls,pending_timeout_head->timeout); | 1076 | task); |
1077 | if (pending_timeout_last == task) | ||
1078 | pending_timeout_last = NULL; | ||
1079 | else | ||
1080 | scheduler_driver->set_wakeup (scheduler_driver->cls, | ||
1081 | pending_timeout_head->timeout); | ||
1082 | } | ||
1076 | if (task == pending_timeout_last) | 1083 | if (task == pending_timeout_last) |
1077 | pending_timeout_last = NULL; | 1084 | pending_timeout_last = NULL; |
1078 | } | 1085 | } |
@@ -2082,7 +2089,7 @@ GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver, | |||
2082 | GNUNET_NETWORK_fdset_handle_set (sh.rs, pr); | 2089 | GNUNET_NETWORK_fdset_handle_set (sh.rs, pr); |
2083 | sh.driver = driver; | 2090 | sh.driver = driver; |
2084 | ret = driver->loop (driver->cls, | 2091 | ret = driver->loop (driver->cls, |
2085 | &sh); | 2092 | &sh); |
2086 | GNUNET_NETWORK_fdset_destroy (sh.rs); | 2093 | GNUNET_NETWORK_fdset_destroy (sh.rs); |
2087 | GNUNET_NETWORK_fdset_destroy (sh.ws); | 2094 | GNUNET_NETWORK_fdset_destroy (sh.ws); |
2088 | 2095 | ||
@@ -2128,7 +2135,7 @@ select_loop(void *cls, | |||
2128 | } | 2135 | } |
2129 | 2136 | ||
2130 | 2137 | ||
2131 | static void | 2138 | void |
2132 | select_set_wakeup(void *cls, | 2139 | select_set_wakeup(void *cls, |
2133 | struct GNUNET_TIME_Absolute dt) | 2140 | struct GNUNET_TIME_Absolute dt) |
2134 | { | 2141 | { |