1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +03:00

IPv6 on esp8266-nonos-sdk and arduino (#5136)

This commit is contained in:
david gauchard
2018-11-27 23:07:47 +01:00
committed by GitHub
parent a501d3ca3b
commit 5c4db3acf4
59 changed files with 1270 additions and 809 deletions

View File

@ -137,22 +137,19 @@ int WiFiClient::connect(const String& host, uint16_t port)
return connect(host.c_str(), port);
}
int WiFiClient::connect(IPAddress ip, uint16_t port)
int WiFiClient::connect(CONST IPAddress& ip, uint16_t port)
{
ip_addr_t addr;
addr.addr = ip;
if (_client) {
stop();
_client->unref();
_client = nullptr;
}
#if LWIP_VERSION_MAJOR == 1
// if the default interface is down, tcp_connect exits early without
// ever calling tcp_err
// http://lists.gnu.org/archive/html/lwip-devel/2010-05/msg00001.html
#if LWIP_VERSION_MAJOR == 1
netif* interface = ip_route(&addr);
netif* interface = ip_route(ip);
if (!interface) {
DEBUGV("no route to host\r\n");
return 0;
@ -170,7 +167,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
_client = new ClientContext(pcb, nullptr, nullptr);
_client->ref();
_client->setTimeout(_timeout);
int res = _client->connect(&addr, port);
int res = _client->connect(ip, port);
if (res == 0) {
_client->unref();
_client = nullptr;