]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_ctrl: Use monotonic time for request retry loop
authorJohannes Berg <johannes.berg@intel.com>
Mon, 16 Dec 2013 20:08:25 +0000 (21:08 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 24 Dec 2013 05:14:50 +0000 (07:14 +0200)
The request retry loop only retries for 5 seconds, so any time
jumps would probably not affect it much, but it should be using
monotonic time nonetheless since it only cares about duration.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

src/common/wpa_ctrl.c

index 83788d7de84a85f159bd52a369d6d8aaf6d83cdf..f4af94aa1c9e40e7e96cfb5638502c6838bbb1f7 100644 (file)
@@ -391,7 +391,7 @@ int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
                     void (*msg_cb)(char *msg, size_t len))
 {
        struct timeval tv;
-       struct os_time started_at;
+       struct os_reltime started_at;
        int res;
        fd_set rfds;
        const char *_cmd;
@@ -430,12 +430,12 @@ retry_send:
                         * longer before giving up.
                         */
                        if (started_at.sec == 0)
-                               os_get_time(&started_at);
+                               os_get_reltime(&started_at);
                        else {
-                               struct os_time n;
-                               os_get_time(&n);
+                               struct os_reltime n;
+                               os_get_reltime(&n);
                                /* Try for a few seconds. */
-                               if (n.sec > started_at.sec + 5)
+                               if (os_reltime_expired(&n, &started_at, 5))
                                        goto send_err;
                        }
                        os_sleep(1, 0);