If the lease time is 1, then we wouldn't wait; that's a bug.
Clean up an obnoxious conditional.

Change-Id: I25ad3c5ac3510d56a0dc3d37b464ca002236875b
Signed-off-by: Dan Cross <cro...@gmail.com>
---
 tools/apps/ipconfig/main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/apps/ipconfig/main.c b/tools/apps/ipconfig/main.c
index db353bd..b534b4f 100644
--- a/tools/apps/ipconfig/main.c
+++ b/tools/apps/ipconfig/main.c
@@ -952,20 +952,17 @@ static void *dhcpwatchthr(void *arg)
        uint32_t t;
        int needconfig = (arg == NULL);
 
-       // procsetname("dhcpwatch");
        /* keep trying to renew the lease */
        for (;;) {
+               secs = conf.lease / 2;
                if (conf.lease == 0)
                        secs = 5;
-               else
-                       secs = conf.lease >> 1;
 
                /* avoid overflows */
                for (s = secs; s > 0; s -= t) {
-                       if (s > Maxsleep)
+                       t = s;
+                       if (t > Maxsleep)
                                t = Maxsleep;
-                       else
-                               t = s;
                        usleep(t * 1000 * 1000);
                }
 
-- 
2.8.0.rc3.226.g39d4020

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akaros+unsubscr...@googlegroups.com.
To post to this group, send email to akaros@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to