summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordaisuke niwa2015-02-27 02:49:39 -0600
committerZoran Jovanovic2015-02-27 02:50:01 -0600
commitc855bddc67f218af09c742527f423075c0017aa8 (patch)
tree20984189f4e1157e9c9126e7cc31048936da852e /libnetutils
parentbe9712156bdcf8cff774a78a3afdb0c562998c73 (diff)
downloadplatform-system-core-c855bddc67f218af09c742527f423075c0017aa8.tar.gz
platform-system-core-c855bddc67f218af09c742527f423075c0017aa8.tar.xz
platform-system-core-c855bddc67f218af09c742527f423075c0017aa8.zip
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 0f7c384c5..70e37c676 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
72 maxnaps = 1; 72 maxnaps = 1;
73 } 73 }
74 74
75 while (maxnaps-- > 0) { 75 while (maxnaps-- >= 0) {
76 usleep(NAP_TIME * 1000);
77 if (property_get(name, value, NULL)) { 76 if (property_get(name, value, NULL)) {
78 if (desired_value == NULL || 77 if (desired_value == NULL ||
79 strcmp(value, desired_value) == 0) { 78 strcmp(value, desired_value) == 0) {
80 return 0; 79 return 0;
81 } 80 }
82 } 81 }
82 if (maxnaps >= 0) {
83 usleep(NAP_TIME * 1000);
84 }
83 } 85 }
84 return -1; /* failure */ 86 return -1; /* failure */
85} 87}