[Bug] [netdev] ping still applies delay after the last packet and calls rt_thread_delay(0) returning -RT_EINVAL
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
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:
- The
index == timescondition is never true inside the loop (index < times), so the delay is still applied after the last packet, contrary to the comment. - When
delay_tickbecomes 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
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RT-Thread/rt-thread 的其他 Issue
-
[bsp][stm32][bluepill] README「快速上手」缺少重新生成 MDK 工程这一步,按文档操作无法编译通过可能已有人在做 @moment-NEW 于 13 天前认领。 未关闭in progress
难度 2/5 1-3 小时 新手友好度 75/100
RT-Thread/rt-thread#11818 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
BSP BSP: Loongson bug RT-Smart
难度 2/5 1-3 小时 新手友好度 72/100
RT-Thread/rt-thread#11717 · 2 条评论 ·
维护者通常 1 天内回复
-
Arch: RISC-V BSP BSP: HPMicro bug
难度 2/5 1-3 小时 新手友好度 72/100
RT-Thread/rt-thread#11687 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
RT-Thread/rt-thread#11472 · 1 条评论 ·
维护者通常 1 天内回复
-
Arch: ARM/AArch64 bug Component
难度 3/5 半天 新手友好度 58/100
RT-Thread/rt-thread#11868 · 1 条评论 ·
维护者通常 1 天内回复
查看 RT-Thread/rt-thread 的全部 Issue
相似的 Issue
-
backlog bug
难度 2/5 1-3 小时 新手友好度 75/100
EchoTools/nevr-runtime#653 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
InfiniTimeOrg/InfiniTime#2492 ·
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复
-
base-files: 82_config_generate: regenerate /etc/board.json if 0-bytes / truncated after power cut未关闭
难度 2/5 1-3 小时 新手友好度 72/100
openwrt/openwrt#25940 · 5 条评论 ·
维护者通常 1 天内回复
-
extension-modules topic-socket type-bug
难度 2/5 1-3 小时 新手友好度 70/100
python/cpython#159561 · 1 个 reaction ·
维护者通常 1 天内回复