You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/05/31 08:01:24 UTC
[incubator-nuttx-apps] branch master updated: netutils/dhcpc: Change the timeout unit to milliseconds
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 8fd4b6105 netutils/dhcpc: Change the timeout unit to milliseconds
8fd4b6105 is described below
commit 8fd4b6105be2a535ecea2312858602d9ffa4e670
Author: zrrong <zr...@bouffalolab.com>
AuthorDate: Fri May 27 11:35:23 2022 +0800
netutils/dhcpc: Change the timeout unit to milliseconds
---
netutils/dhcpc/Kconfig | 4 ++--
netutils/dhcpc/dhcpc.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/netutils/dhcpc/Kconfig b/netutils/dhcpc/Kconfig
index 8c2cf4c74..52688e65e 100644
--- a/netutils/dhcpc/Kconfig
+++ b/netutils/dhcpc/Kconfig
@@ -18,8 +18,8 @@ config NETUTILS_DHCPC_HOST_NAME
default "nuttx"
config NETUTILS_DHCPC_RECV_TIMEOUT
- int "Number of receive timeout in second"
- default 3
+ int "Number of receive timeout in millisecond"
+ default 3000
---help---
This is the timeout value when dhcp client receives response
diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c
index 8df922165..69153e89e 100644
--- a/netutils/dhcpc/dhcpc.c
+++ b/netutils/dhcpc/dhcpc.c
@@ -552,8 +552,8 @@ FAR void *dhcpc_open(FAR const char *interface, FAR const void *macaddr,
/* Configure for read timeouts */
- tv.tv_sec = CONFIG_NETUTILS_DHCPC_RECV_TIMEOUT;
- tv.tv_usec = 0;
+ tv.tv_sec = CONFIG_NETUTILS_DHCPC_RECV_TIMEOUT / 1000;
+ tv.tv_usec = (CONFIG_NETUTILS_DHCPC_RECV_TIMEOUT % 1000) * 1000;
ret = setsockopt(pdhcpc->sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv,
sizeof(struct timeval));