diff options
| author | Irfan Sheriff <isheriff@google.com> | 2010-12-21 10:31:05 -0800 |
|---|---|---|
| committer | Irfan Sheriff <isheriff@google.com> | 2010-12-21 11:15:28 -0800 |
| commit | b1723b68921512f26562384898b9600f8f11d25e (patch) | |
| tree | f56c639c6e5ff5bf9e644160329dfbc649c5717f /libnetutils | |
| parent | 36f93f01201bbff4a411c73adfbaf08bd93b1ad2 (diff) | |
| download | system_core-b1723b68921512f26562384898b9600f8f11d25e.tar.gz system_core-b1723b68921512f26562384898b9600f8f11d25e.tar.bz2 system_core-b1723b68921512f26562384898b9600f8f11d25e.zip | |
Reduce polling interval to 200ms
DHCP success can take up to 2 seconds to
be reported to the statemachine. Move wait
time after check and reduce it to 200ms
Change-Id: I6b2546f80435a84ee6f44f4d91f348bacfdc8433
Diffstat (limited to 'libnetutils')
| -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) { |
