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 摘要。