1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-01 01:22:20 +01:00

Fix socket connection closed not detected (#2587)

This commit is contained in:
Otto Winter
2021-10-22 10:46:44 +02:00
committed by GitHub
parent 68c8547067
commit 9220d9fc52
5 changed files with 53 additions and 15 deletions

View File

@@ -320,8 +320,7 @@ class LWIPRawImpl : public Socket {
return -1;
}
if (rx_closed_ && rx_buf_ == nullptr) {
errno = ECONNRESET;
return -1;
return 0;
}
if (len == 0) {
return 0;
@@ -366,6 +365,11 @@ class LWIPRawImpl : public Socket {
read += copysize;
}
if (read == 0) {
errno = EWOULDBLOCK;
return -1;
}
return read;
}
ssize_t readv(const struct iovec *iov, int iovcnt) override {