summaryrefslogtreecommitdiffstats
path: root/libnetutils
diff options
context:
space:
mode:
authordaisuke niwa <daisuke.x.niwa@sonymobile.com>2015-02-27 09:49:39 +0100
committerZoran Jovanovic <zoran.jovanovic@sonymobile.com>2015-02-27 09:50:01 +0100
commitc855bddc67f218af09c742527f423075c0017aa8 (patch)
tree20984189f4e1157e9c9126e7cc31048936da852e /libnetutils
parentbe9712156bdcf8cff774a78a3afdb0c562998c73 (diff)
downloadsystem_core-c855bddc67f218af09c742527f423075c0017aa8.zip
system_core-c855bddc67f218af09c742527f423075c0017aa8.tar.gz
system_core-c855bddc67f218af09c742527f423075c0017aa8.tar.bz2
Improving the time to wait for assigning IP address
Framework always spends 600msec for getting IP address. DhcpStateMachine.runDhcp calls NetworkUtils.stopDhcp. After that, it calls NetworkUtils.runDhcp. In this case, wait_for_property of dhcp_utils.c calls three times. At least three times, usleep is called. So move usleep statement after property_get statement. Change-Id: I77ffb9a5a64875b47bb528b494bb60b68c1acb5a
Diffstat (limited to 'libnetutils')
-rw-r--r--libnetutils/dhcp_utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index 0f7c384..70e37c6 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -72,14 +72,16 @@ static int wait_for_property(const char *name, const char *desired_value, int ma
maxnaps = 1;
}
- while (maxnaps-- > 0) {
- usleep(NAP_TIME * 1000);
+ while (maxnaps-- >= 0) {
if (property_get(name, value, NULL)) {
if (desired_value == NULL ||
strcmp(value, desired_value) == 0) {
return 0;
}
}
+ if (maxnaps >= 0) {
+ usleep(NAP_TIME * 1000);
+ }
}
return -1; /* failure */
}