Lines Matching full:timeout
42 struct dl_list timeout;
59 dl_list_init(&eloop.timeout);
115 struct eloop_timeout *timeout, *tmp;
118 timeout = os_zalloc(sizeof(*timeout));
119 if (timeout == NULL)
121 if (os_get_time(&timeout->time) < 0) {
122 os_free(timeout);
125 now_sec = timeout->time.sec;
126 timeout->time.sec += secs;
127 if (timeout->time.sec < now_sec) {
129 * Integer overflow - assume long enough timeout to be assumed
130 * to be infinite, i.e., the timeout would never happen.
132 wpa_printf(MSG_DEBUG, "ELOOP: Too long timeout (secs=%u) to "
134 os_free(timeout);
137 timeout->time.usec += usecs;
138 while (timeout->time.usec >= 1000000) {
139 timeout->time.sec++;
140 timeout->time.usec -= 1000000;
142 timeout->eloop_data = eloop_data;
143 timeout->user_data = user_data;
144 timeout->handler = handler;
147 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
148 if (os_time_before(&timeout->time, &tmp->time)) {
149 dl_list_add(tmp->list.prev, &timeout->list);
153 dl_list_add_tail(&eloop.timeout, &timeout->list);
159 static void eloop_remove_timeout(struct eloop_timeout *timeout)
161 dl_list_del(&timeout->list);
162 os_free(timeout);
169 struct eloop_timeout *timeout, *prev;
172 dl_list_for_each_safe(timeout, prev, &eloop.timeout,
174 if (timeout->handler == handler &&
175 (timeout->eloop_data == eloop_data ||
177 (timeout->user_data == user_data ||
179 eloop_remove_timeout(timeout);
192 struct eloop_timeout *timeout, *prev;
199 dl_list_for_each_safe(timeout, prev, &eloop.timeout,
201 if (timeout->handler == handler &&
202 (timeout->eloop_data == eloop_data) &&
203 (timeout->user_data == user_data)) {
205 if (os_time_before(&now, &timeout->time))
206 os_time_sub(&timeout->time, &now, remaining);
207 eloop_remove_timeout(timeout);
220 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
324 (!dl_list_empty(&eloop.timeout) || eloop.reader_count > 0)) {
325 struct eloop_timeout *timeout;
326 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
328 if (timeout) {
330 if (os_time_before(&now, &timeout->time))
331 os_time_sub(&timeout->time, &now, &tv);
337 * TODO: wait for any event (read socket ready, timeout (tv),
345 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
347 if (timeout) {
349 if (!os_time_before(&now, &timeout->time)) {
350 void *eloop_data = timeout->eloop_data;
351 void *user_data = timeout->user_data;
353 timeout->handler;
354 eloop_remove_timeout(timeout);
387 struct eloop_timeout *timeout, *prev;
389 dl_list_for_each_safe(timeout, prev, &eloop.timeout,
391 eloop_remove_timeout(timeout);