aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/eloop_win.c
diff options
context:
space:
mode:
authorPontus Fuchs <pontus.fuchs@gmail.com>2013-02-03 15:17:08 (GMT)
committerJouni Malinen <j@w1.fi>2013-02-03 15:17:08 (GMT)
commitc869536ce9ed0755ff0138ccdafeae8a996a5e3a (patch)
treed93ec6db84c93ca8f5fefdaa675a9d89aecaef08 /src/utils/eloop_win.c
parent328bc71776dccb74824737e88009ffb6ef25af21 (diff)
downloadhostap-c869536ce9ed0755ff0138ccdafeae8a996a5e3a.zip
hostap-c869536ce9ed0755ff0138ccdafeae8a996a5e3a.tar.gz
hostap-c869536ce9ed0755ff0138ccdafeae8a996a5e3a.tar.bz2
eloop: Add a timer cancel that returns the remaining time
This new cancel timer will give back the remaining time if it was pending. Signed-hostap: Pontus Fuchs <pontus.fuchs@gmail.com>
Diffstat (limited to 'src/utils/eloop_win.c')
-rw-r--r--src/utils/eloop_win.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/eloop_win.c b/src/utils/eloop_win.c
index 206f1c3..eda412f 100644
--- a/src/utils/eloop_win.c
+++ b/src/utils/eloop_win.c
@@ -311,6 +311,33 @@ int eloop_cancel_timeout(eloop_timeout_handler handler,
}
+int eloop_cancel_timeout_one(eloop_timeout_handler handler,
+ void *eloop_data, void *user_data,
+ struct os_time *remaining)
+{
+ struct eloop_timeout *timeout, *prev;
+ int removed = 0;
+ struct os_time now;
+
+ os_get_time(&now);
+ remaining->sec = remaining->usec = 0;
+
+ dl_list_for_each_safe(timeout, prev, &eloop.timeout,
+ struct eloop_timeout, list) {
+ if (timeout->handler == handler &&
+ (timeout->eloop_data == eloop_data) &&
+ (timeout->user_data == user_data)) {
+ removed = 1;
+ if (os_time_before(&now, &timeout->time))
+ os_time_sub(&timeout->time, &now, remaining);
+ eloop_remove_timeout(timeout);
+ break;
+ }
+ }
+ return removed;
+}
+
+
int eloop_is_timeout_registered(eloop_timeout_handler handler,
void *eloop_data, void *user_data)
{