Skip to content

Fixes #3537 #3541

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

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
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
11 changes: 10 additions & 1 deletion libraries/ESP8266WiFi/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ extern "C" int __ax_port_read(int fd, uint8_t* buffer, size_t count)
}
extern "C" void ax_port_read() __attribute__ ((weak, alias("__ax_port_read")));

uint8_t ax_port_write_retries = 0;
extern "C" int __ax_port_write(int fd, uint8_t* buffer, size_t count)
{
ClientContext* _client = SSLContext::getIOContext(fd);
Expand All @@ -643,7 +644,15 @@ extern "C" int __ax_port_write(int fd, uint8_t* buffer, size_t count)

size_t cb = _client->write(buffer, count);
if (cb != count) {
errno = EAGAIN;
if (++ax_port_write_retries > 0x19) {
DEBUGV("ssl_write: Exceeded max write retries");
_client->close();
ax_port_write_retries = 0;
errno = ENOTCONN;
}
else errno = EAGAIN;
} else {
ax_port_write_retries = 0;
}
return cb;
}
Expand Down