Skip to content

Increase default timeout for WiFiClient from 3ms to 3s #5496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions libraries/WiFi/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include <lwip/netdb.h>
#include <errno.h>

#define WIFI_CLIENT_DEF_CONN_TIMEOUT (3)
#define WIFI_CLIENT_MAX_WRITE_RETRY (10)
#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)
#define WIFI_CLIENT_FLUSH_BUFFER_SIZE (1024)
#define WIFI_CLIENT_DEF_CONN_TIMEOUT_MS (3000)
#define WIFI_CLIENT_MAX_WRITE_RETRY (10)
#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)
#define WIFI_CLIENT_FLUSH_BUFFER_SIZE (1024)

#undef connect
#undef write
Expand Down Expand Up @@ -208,9 +208,9 @@ void WiFiClient::stop()

int WiFiClient::connect(IPAddress ip, uint16_t port)
{
return connect(ip,port,WIFI_CLIENT_DEF_CONN_TIMEOUT);
}
int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)
return connect(ip,port,WIFI_CLIENT_DEF_CONN_TIMEOUT_MS);
}
int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout )
{
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
Expand Down Expand Up @@ -279,9 +279,9 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)

int WiFiClient::connect(const char *host, uint16_t port)
{
return connect(host,port,WIFI_CLIENT_DEF_CONN_TIMEOUT);
}
int WiFiClient::connect(const char *host, uint16_t port, int32_t timeout)
return connect(host,port,WIFI_CLIENT_DEF_CONN_TIMEOUT_MS);
}
int WiFiClient::connect(const char *host, uint16_t port, int32_t timeout )
{
IPAddress srv((uint32_t)0);
if(!WiFiGenericClass::hostByName(host, srv)){
Expand Down