8000 fixes for WiFiClient::write(Stream) by d-a-v · Pull Request #7987 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

fixes for WiFiClient::write(Stream) #7987

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 8 commits into from
Apr 27, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
sync API on host emulation
  • Loading branch information
d-a-v committed Apr 21, 2021
commit c065a3b23daf1ab1d9803b58400d124daa118d2f
26 changes: 2 additions & 24 deletions tests/host/common/include/ClientContext.h
4C93
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ class ClientContext
return _sock >= 0? ESTABLISHED: CLOSED;
}

size_t write(const uint8_t* data, size_t size)
size_t write(const char* data, size_t size)
{
ssize_t ret = mockWrite(_sock, data, size, _timeout_ms);
ssize_t ret = mockWrite(_sock, (const uint8_t*)data, size, _timeout_ms);
if (ret < 0)
{
abort();
Expand All @@ -234,28 +234,6 @@ class ClientContext
return ret;
}

size_t write(Stream& stream)
{
size_t avail = stream.available();
uint8_t buf [avail];
avail = stream.readBytes(buf, avail);
size_t totwrote = 0;
uint8_t* w = buf;
while (avail && _sock >= 0)
{
size_t wrote = write(w, avail);
w += wrote;
avail -= wrote;
totwrote += wrote;
}
return totwrote;
}

size_t write_P(PGM_P buf, size_t size)
{
return write((const uint8_t*)buf, size);
}

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)
{
(void) idle_sec;
Expand Down
0