Increase default timeout for WiFiClient from 3ms to 3s (#5496)
## Summary
https://github.com/espressif/arduino-esp32/pull/5487 introduced a default timeout for WiFiClient, however the default was specified in milliseconds instead of seconds, see be84c8219c (commitcomment-54358731)
This 3ms timeout breaks OTA when the processor is busy.
## Impact
Sets the default to a saner value, fixes OTA.
This commit is contained in:
parent
0b0dfab3cf
commit
0acbe781f5
@ -23,10 +23,10 @@
|
|||||||
#include <lwip/netdb.h>
|
#include <lwip/netdb.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define WIFI_CLIENT_DEF_CONN_TIMEOUT (3)
|
#define WIFI_CLIENT_DEF_CONN_TIMEOUT_MS (3000)
|
||||||
#define WIFI_CLIENT_MAX_WRITE_RETRY (10)
|
#define WIFI_CLIENT_MAX_WRITE_RETRY (10)
|
||||||
#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)
|
#define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000)
|
||||||
#define WIFI_CLIENT_FLUSH_BUFFER_SIZE (1024)
|
#define WIFI_CLIENT_FLUSH_BUFFER_SIZE (1024)
|
||||||
|
|
||||||
#undef connect
|
#undef connect
|
||||||
#undef write
|
#undef write
|
||||||
@ -208,9 +208,9 @@ void WiFiClient::stop()
|
|||||||
|
|
||||||
int WiFiClient::connect(IPAddress ip, uint16_t port)
|
int WiFiClient::connect(IPAddress ip, uint16_t port)
|
||||||
{
|
{
|
||||||
return connect(ip,port,WIFI_CLIENT_DEF_CONN_TIMEOUT);
|
return connect(ip,port,WIFI_CLIENT_DEF_CONN_TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)
|
int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout )
|
||||||
{
|
{
|
||||||
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
@ -279,9 +279,9 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)
|
|||||||
|
|
||||||
int WiFiClient::connect(const char *host, uint16_t port)
|
int WiFiClient::connect(const char *host, uint16_t port)
|
||||||
{
|
{
|
||||||
return connect(host,port,WIFI_CLIENT_DEF_CONN_TIMEOUT);
|
return connect(host,port,WIFI_CLIENT_DEF_CONN_TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
int WiFiClient::connect(const char *host, uint16_t port, int32_t timeout)
|
int WiFiClient::connect(const char *host, uint16_t port, int32_t timeout )
|
||||||
{
|
{
|
||||||
IPAddress srv((uint32_t)0);
|
IPAddress srv((uint32_t)0);
|
||||||
if(!WiFiGenericClass::hostByName(host, srv)){
|
if(!WiFiGenericClass::hostByName(host, srv)){
|
||||||
|
Loading…
Reference in New Issue
Block a user