Skip to content

Commit 8e61d57

Browse files
committed
add recv error code for clarifying timeout
1 parent ab1762c commit 8e61d57

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net.c

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ int redisNetRead(redisContext *c, char *buf, size_t bufcap) {
6363
if ((errno == EWOULDBLOCK && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
6464
/* Try again later */
6565
return 0;
66+
} else if(errno == ETIMEDOUT && (c->flags & REDIS_BLOCK)) {
67+
/* especially in windows */
68+
__redisSetError(c, REDIS_ERR_TIMEOUT, "recv timeout");
69+
return -1;
6670
} else {
6771
__redisSetError(c, REDIS_ERR_IO, NULL);
6872
return -1;

0 commit comments

Comments
 (0)