Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug] [netdev] ping still applies delay after the last packet and calls rt_thread_delay(0) returning -RT_EINVAL

已关闭
#11,865 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@ymj0440 已经在做这个了。

开始于 2026年10月14日。

  • #11866 来自 @ymj0440 —— 已合并

评估

这个 Issue 还没有评估数据。

描述

in progress

In netdev_cmd_ping(), the loop tries to skip the inter-packet delay on the final ping:

/* if the response time is more than NETDEV_PING_DELAY, no need to delay */
delay_tick = ((rt_tick_get() - start_tick) > NETDEV_PING_DELAY) || (index == times) ? 0 : NETDEV_PING_DELAY;
rt_thread_delay(delay_tick);

Two issues:

  1. The index == times condition is never true inside the loop (index < times), so the delay is still applied after the last packet, contrary to the comment.
  2. When delay_tick becomes 0, rt_thread_delay(0) is still called and returns -RT_EINVAL (invalid argument).

Proposed fix: compute the actual elapsed time, skip the delay on the last packet via index != times - 1, and only call rt_thread_delay() when delay_tick > 0.

主要语言
C
星标
12.3k
派生
5.5k
平均合并
7 天 19 小时
30 天内合并 PR
32

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RT-Thread/rt-thread 的其他 Issue

查看 RT-Thread/rt-thread 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。