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

prepare lwip2 (#3129)

* minimum changes for libraries to compile with lwip2

* add WiFiClient::availableForWrite() (similar to Serial::) which indicates how much data can be sent without buffering
This commit is contained in:
david gauchard
2017-04-25 15:55:01 +02:00
committed by Ivan Grokhotkov
parent a9224266f3
commit a41f55c469
6 changed files with 51 additions and 4 deletions

View File

@ -106,11 +106,13 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
// 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);
if (!interface) {
DEBUGV("no route to host\r\n");
return 0;
}
#endif
tcp_pcb* pcb = tcp_new();
if (!pcb)
@ -163,6 +165,11 @@ bool WiFiClient::getNoDelay() {
return _client->getNoDelay();
}
size_t WiFiClient::availableForWrite ()
{
return _client->availableForWrite();
}
size_t WiFiClient::write(uint8_t b)
{
return write(&b, 1);