diff --git a/cspot/src/PlainConnection.cpp b/cspot/src/PlainConnection.cpp index 1bff6cf..b4ee6ff 100644 --- a/cspot/src/PlainConnection.cpp +++ b/cspot/src/PlainConnection.cpp @@ -150,6 +150,10 @@ void PlainConnection::readBlock(const uint8_t* dst, size_t size) { case EINTR: break; default: + // diagnostic (project patch): n == 0 means the peer closed (FIN); n < 0 with errno + // e.g. ECONNRESET (RST). Note errno is not updated when n == 0. + CSPOT_LOG(error, "recv returned %d, errno %d, %u of %u bytes, retry %d", (int)n, + getErrno(), idx, (unsigned)size, retries); if (retries++ > 4) throw std::runtime_error("Error in read"); goto READ;