Skip to content

Commit e8cdc74

Browse files
authored
Merge branch 'RT-Thread:master' into master
2 parents d93f81b + 25b6953 commit e8cdc74

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

  • components/net/lwip
    • lwip-1.4.1/src/apps/ping
    • lwip-2.0.3/src/apps/ping
    • lwip-2.1.2/src/apps/ping

components/net/lwip/lwip-1.4.1/src/apps/ping/ping.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ int lwip_ping_recv(int s, int *ttl)
135135
/* using the lwIP custom ping */
136136
rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
137137
{
138-
#if LWIP_VERSION_MAJOR >= 2U
139-
struct timeval timeout = { PING_RCV_TIMEO / RT_TICK_PER_SECOND, PING_RCV_TIMEO % RT_TICK_PER_SECOND };
138+
139+
#if LWIP_SO_SNDRCVTIMEO_NONSTANDARD
140+
int timeout = (int)PING_RCV_TIMEO;
140141
#else
141-
int timeout = PING_RCV_TIMEO * 1000UL / RT_TICK_PER_SECOND;
142-
#endif
142+
struct timeval timeout = { PING_RCV_TIMEO / RT_TICK_PER_SECOND, PING_RCV_TIMEO % RT_TICK_PER_SECOND };
143+
#endif / * LWIP_SO_SNDRCVTIMEO_NONSTANDARD */
143144

144145
int s, ttl, recv_len;
145146
ip_addr_t target_addr;

components/net/lwip/lwip-2.0.3/src/apps/ping/ping.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ int lwip_ping_recv(int s, int *ttl)
135135
/* using the lwIP custom ping */
136136
rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
137137
{
138-
#if LWIP_VERSION_MAJOR >= 2U
139-
struct timeval timeout = { PING_RCV_TIMEO / RT_TICK_PER_SECOND, PING_RCV_TIMEO % RT_TICK_PER_SECOND };
138+
139+
#if LWIP_SO_SNDRCVTIMEO_NONSTANDARD
140+
int timeout = (int)PING_RCV_TIMEO;
140141
#else
141-
int timeout = PING_RCV_TIMEO * 1000UL / RT_TICK_PER_SECOND;
142-
#endif
142+
struct timeval timeout = { PING_RCV_TIMEO / RT_TICK_PER_SECOND, PING_RCV_TIMEO % RT_TICK_PER_SECOND };
143+
#endif / * LWIP_SO_SNDRCVTIMEO_NONSTANDARD */
143144

144145
int s, ttl, recv_len;
145146
ip_addr_t target_addr;

components/net/lwip/lwip-2.1.2/src/apps/ping/ping.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ int lwip_ping_recv(int s, int *ttl)
135135
/* using the lwIP custom ping */
136136
rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
137137
{
138-
#if LWIP_VERSION_MAJOR >= 2U
139-
struct timeval timeout = { PING_RCV_TIMEO / RT_TICK_PER_SECOND, PING_RCV_TIMEO % RT_TICK_PER_SECOND };
138+
139+
#if LWIP_SO_SNDRCVTIMEO_NONSTANDARD
140+
int timeout = (int)PING_RCV_TIMEO;
140141
#else
141-
int timeout = PING_RCV_TIMEO * 1000UL / RT_TICK_PER_SECOND;
142-
#endif
142+
struct timeval timeout = { PING_RCV_TIMEO / RT_TICK_PER_SECOND, PING_RCV_TIMEO % RT_TICK_PER_SECOND };
143+
#endif / * LWIP_SO_SNDRCVTIMEO_NONSTANDARD */
143144

144145
int s, ttl, recv_len;
145146
ip_addr_t target_addr;

0 commit comments

Comments
 (0)