Skip to content

Commit d5b9743

Browse files
authored
Merge pull request #407 from embhorn/gh406
Handle connection error in mqttsimple client
2 parents 6db6c74 + 7af0188 commit d5b9743

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/mqttsimple/mqttsimple.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int mqtt_net_read(void *context, byte* buf, int buf_len, int timeout_ms)
229229
/* Loop until buf_len has been read, error or timeout */
230230
while (bytes < buf_len) {
231231
rc = (int)recv(*pSockFd, &buf[bytes], buf_len - bytes, 0);
232-
if (rc < 0) {
232+
if (rc <= 0) {
233233
rc = socket_get_error(*pSockFd);
234234
if (rc == 0)
235235
break; /* timeout */

0 commit comments

Comments
 (0)