mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-25 20:02:37 +03:00
Merge branch 'master' into hwserial
This commit is contained in:
commit
eb1966b6a9
@ -40,6 +40,7 @@ extern "C"
|
||||
#include "lwip/netif.h"
|
||||
#include <include/ClientContext.h>
|
||||
#include "c_types.h"
|
||||
#include <StreamDev.h>
|
||||
|
||||
uint16_t WiFiClient::_localPort = 0;
|
||||
|
||||
@ -212,7 +213,8 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
|
||||
return 0;
|
||||
}
|
||||
_client->setTimeout(_timeout);
|
||||
return _client->write(buf, size);
|
||||
StreamConstPtr ptr(buf, size);
|
||||
return _client->write(ptr);
|
||||
}
|
||||
|
||||
size_t WiFiClient::write(Stream& stream, size_t unused)
|
||||
@ -227,8 +229,12 @@ size_t WiFiClient::write(Stream& stream)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
_client->setTimeout(_timeout);
|
||||
return _client->write(stream);
|
||||
if (stream.hasPeekBufferAPI())
|
||||
{
|
||||
_client->setTimeout(_timeout);
|
||||
return _client->write(stream);
|
||||
}
|
||||
return stream.sendAvailable(this);
|
||||
}
|
||||
|
||||
size_t WiFiClient::write_P(PGM_P buf, size_t size)
|
||||
@ -238,7 +244,8 @@ size_t WiFiClient::write_P(PGM_P buf, size_t size)
|
||||
return 0;
|
||||
}
|
||||
_client->setTimeout(_timeout);
|
||||
return _client->write_P(buf, size);
|
||||
StreamConstPtr nopeek(buf, size);
|
||||
return nopeek.sendAll(this);
|
||||
}
|
||||
|
||||
int WiFiClient::available()
|
||||
|
@ -31,6 +31,7 @@ extern "C" void esp_schedule();
|
||||
|
||||
#include <assert.h>
|
||||
#include <StreamDev.h>
|
||||
#include <esp_priv.h>
|
||||
|
||||
bool getDefaultPrivateGlobalSyncValue ();
|
||||
|
||||
@ -372,32 +373,15 @@ public:
|
||||
return _pcb->state;
|
||||
}
|
||||
|
||||
size_t write(const uint8_t* data, size_t size)
|
||||
{
|
||||
if (!_pcb) {
|
||||
return 0;
|
||||
}
|
||||
StreamConstPtr ptr(data, size);
|
||||
return _write_from_source(&ptr);
|
||||
}
|
||||
|
||||
size_t write(Stream& stream)
|
||||
{
|
||||
if (!_pcb) {
|
||||
return 0;
|
||||
}
|
||||
assert(stream.hasPeekBufferAPI());
|
||||
return _write_from_source(&stream);
|
||||
}
|
||||
|
||||
size_t write_P(PGM_P buf, size_t size)
|
||||
{
|
||||
if (!_pcb) {
|
||||
return 0;
|
||||
}
|
||||
StreamConstPtr ptr(buf, size);
|
||||
return _write_from_source(&ptr);
|
||||
}
|
||||
|
||||
void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT)
|
||||
{
|
||||
if (idle_sec && intv_sec && count) {
|
||||
@ -504,7 +488,6 @@ protected:
|
||||
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
||||
delay(1);
|
||||
// will resume on timeout or when _write_some_from_cb or _notify_error fires
|
||||
|
||||
}
|
||||
_send_waiting = false;
|
||||
} while(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user