Skip to content

Commit

Permalink
Fixes esp8266#3537
Browse files Browse the repository at this point in the history
  • Loading branch information
cristovao-trevisan committed Aug 22, 2017
1 parent 4897e00 commit 1b9e3f2
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions libraries/ESP8266WiFi/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,17 +605,24 @@ 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")));

extern "C" int __ax_port_write(int fd, uint8_t* buffer, size_t count)
{
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);
if (!_client || _client->state() != ESTABLISHED) {
errno = EIO;
return -1;
}

size_t cb = _client->write(buffer, count);
size_t cb = _client->write((const char*) 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

0 comments on commit 1b9e3f2

Please sign in to comment.