Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng
#11,865 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ymj0440 đang làm issue này rồi.

Từ ngày 14/10/2026.

  • #11866 của @ymj0440 — đã merge

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
C
Star
12.3k
Fork
5.5k
Merge trung bình
7 ngày 4 giờ
Pull request đã merge (30 ngày)
34

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RT-Thread/rt-thread

Tất cả issue của RT-Thread/rt-thread

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.