Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a56bdf

Browse filesBrowse files
authored
Merge pull request #1038 from megacct/ping-timeout
Ping: Expose timeout to interfaces
2 parents 34d8b26 + 04be799 commit 8a56bdf
Copy full SHA for 8a56bdf

File tree

2 files changed

+10
-10
lines changed
Filter options

2 files changed

+10
-10
lines changed

‎libraries/SocketWrapper/src/SocketHelpers.cpp

Copy file name to clipboardExpand all lines: libraries/SocketWrapper/src/SocketHelpers.cpp
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ arduino::IPAddress arduino::MbedSocketClass::dnsIP(int n) {
7575
return ipAddressFromSocketAddress(ip);
7676
}
7777

78-
int arduino::MbedSocketClass::ping(const char *hostname, uint8_t ttl)
78+
int arduino::MbedSocketClass::ping(const char *hostname, uint8_t ttl, uint32_t timeout)
7979
{
8080
SocketAddress socketAddress;
8181
gethostbyname(getNetwork(),hostname, &socketAddress);
82-
return ping(socketAddress, ttl);
82+
return ping(socketAddress, ttl, timeout);
8383
}
8484

85-
int arduino::MbedSocketClass::ping(const String &hostname, uint8_t ttl)
85+
int arduino::MbedSocketClass::ping(const String &hostname, uint8_t ttl, uint32_t timeout)
8686
{
87-
return ping(hostname.c_str(), ttl);
87+
return ping(hostname.c_str(), ttl, timeout);
8888
}
8989

90-
int arduino::MbedSocketClass::ping(IPAddress host, uint8_t ttl)
90+
int arduino::MbedSocketClass::ping(IPAddress host, uint8_t ttl, uint32_t timeout)
9191
{
9292
SocketAddress socketAddress = socketAddressFromIpAddress(host, 0);
93-
return ping(socketAddress, ttl);
93+
return ping(socketAddress, ttl, timeout);
9494
}
9595

9696
void arduino::MbedSocketClass::config(arduino::IPAddress local_ip) {

‎libraries/SocketWrapper/src/SocketHelpers.h

Copy file name to clipboardExpand all lines: libraries/SocketWrapper/src/SocketHelpers.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ class MbedSocketClass {
118118
*
119119
* return: RTT in milliseconds or -1 on error
120120
*/
121-
int ping(const char* hostname, uint8_t ttl = 255);
122-
int ping(const String &hostname, uint8_t ttl = 255);
123-
int ping(IPAddress host, uint8_t ttl = 255);
121+
int ping(const char* hostname, uint8_t ttl = 255, uint32_t timeout = 5000);
122+
int ping(const String &hostname, uint8_t ttl = 255, uint32_t timeout = 5000);
123+
int ping(IPAddress host, uint8_t ttl = 255, uint32_t timeout = 5000);
124124

125125
/*
126126
* Download a file from an HTTP endpoint and save it in the provided `target` location on the fs
@@ -185,7 +185,7 @@ class MbedSocketClass {
185185

186186
void body_callback(const char* data, uint32_t data_len);
187187

188-
int ping(SocketAddress &socketAddress, uint8_t ttl, uint32_t timeout = 5000);
188+
int ping(SocketAddress &socketAddress, uint8_t ttl, uint32_t timeout);
189189
static arduino::IPAddress ipAddressFromSocketAddress(SocketAddress socketAddress);
190190
static SocketAddress socketAddressFromIpAddress(arduino::IPAddress ip, uint16_t port);
191191
static nsapi_error_t gethostbyname(NetworkInterface* interface, const char* aHostname, SocketAddress* socketAddress);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.