diff options
| author | Irfan Sheriff <isheriff@google.com> | 2010-12-21 11:44:41 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-21 11:44:41 -0800 |
| commit | bdd483830d6b18a4840e5b8483bf058f3c4579eb (patch) | |
| tree | e2d317b1510c9775d30624a6dcb3ac9fc977a55e | |
| parent | 752923c168009d03e9e00e590155fbd0a2880ccb (diff) | |
| parent | b1723b68921512f26562384898b9600f8f11d25e (diff) | |
| download | system_core-bdd483830d6b18a4840e5b8483bf058f3c4579eb.tar.gz system_core-bdd483830d6b18a4840e5b8483bf058f3c4579eb.tar.bz2 system_core-bdd483830d6b18a4840e5b8483bf058f3c4579eb.zip | |
Merge "Reduce polling interval to 200ms"
| -rw-r--r-- | libnetutils/dhcp_utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c index f02a44a1..18026882 100644 --- a/libnetutils/dhcp_utils.c +++ b/libnetutils/dhcp_utils.c @@ -29,7 +29,7 @@ static const char DAEMON_NAME[] = "dhcpcd"; static const char DAEMON_PROP_NAME[] = "init.svc.dhcpcd"; static const char HOSTNAME_PROP_NAME[] = "net.hostname"; static const char DHCP_PROP_NAME_PREFIX[] = "dhcp"; -static const int NAP_TIME = 1; /* wait for 1 second at a time */ +static const int NAP_TIME = 200; /* wait for 200ms at a time */ /* when polling for property values */ static char errmsg[100]; @@ -42,14 +42,14 @@ static char errmsg[100]; static int wait_for_property(const char *name, const char *desired_value, int maxwait) { char value[PROPERTY_VALUE_MAX] = {'\0'}; - int maxnaps = maxwait / NAP_TIME; + int maxnaps = (maxwait * 1000) / NAP_TIME; if (maxnaps < 1) { maxnaps = 1; } while (maxnaps-- > 0) { - usleep(1000000); + usleep(NAP_TIME * 1000); if (property_get(name, value, NULL)) { if (desired_value == NULL || strcmp(value, desired_value) == 0) { |
