[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 天內回覆
-
system: coco
難度 1/5 1 小時以內 新手友好度 90/100
FujiNetWIFI/fujinet-config#274 ·
維護者通常 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 天內回覆