From 4cc7af6ef6d22b4e37aab149d53c03b868101073 Mon Sep 17 00:00:00 2001 From: Robert Love Date: Tue, 10 Jan 2006 22:06:56 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1312 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- src/autoip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/autoip.c b/src/autoip.c index 587f4554dd..59ddd39e17 100644 --- a/src/autoip.c +++ b/src/autoip.c @@ -281,9 +281,11 @@ gboolean get_autoip (NMDevice *dev, struct in_addr *out_ip) } else { - /* FIXME: we need to randomize the timeout _between_ MIN and MAX */ + unsigned int usecs_to_sleep = ((PROBE_MAX - PROBE_MIN) * 1000000) - 1; + + /* We want to sleep between PROBE_MIN and PROBE_MAX seconds, exclusive */ timeout.tv_sec += PROBE_MIN; - timeout.tv_usec += (random () % 200000); + timeout.tv_usec += 1 + (random () % usecs_to_sleep); } } else if (nannounce < ANNOUNCE_NUM)