From 0cbb665a1c1c30ab9e3cb9b0f8821492bd6cff36 Mon Sep 17 00:00:00 2001 From: Yohozzy <30695577+Yohozzy@users.noreply.github.com> Date: Mon, 29 May 2023 14:02:01 +0800 Subject: [PATCH] =?UTF-8?q?[components]=20[lwip]=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=20:=20ping=E8=B6=85=E6=97=B6=E8=AE=A1?= =?UTF-8?q?=E7=AE=97bug=20(#7545)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 函数的输入超时参数的单位是ms, 系统接口无论1.x版本还是2.x, 最终都会将毫秒时间再去转一次tick, 用于rtthread邮件接收超时. 所以此处直接按原值进行转换,不需要加入对RT_TICK_PER_SECOND的转换 --- components/net/lwip/port/ethernetif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/net/lwip/port/ethernetif.c b/components/net/lwip/port/ethernetif.c index fa2ed36edd..85d8dba0cb 100644 --- a/components/net/lwip/port/ethernetif.c +++ b/components/net/lwip/port/ethernetif.c @@ -208,9 +208,9 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, int elapsed_time; rt_tick_t recv_start_tick; #if LWIP_VERSION_MAJOR == 1U /* v1.x */ - int recv_timeout = timeout * 1000UL / RT_TICK_PER_SECOND; + int recv_timeout = timeout; #else /* >= v2.x */ - struct timeval recv_timeout = { timeout / RT_TICK_PER_SECOND, timeout % RT_TICK_PER_SECOND }; + struct timeval recv_timeout = { timeout / 1000UL, timeout % 1000UL * 1000 }; #endif ip_addr_t target_addr; struct addrinfo hint, *res = RT_NULL; -- GitLab