add recv error code for clarifying timeout

This commit is contained in:
Sangmoon Yi 2019-08-12 10:55:08 +09:00
parent ab1762cd92
commit 8e61d5737a
1 changed files with 4 additions and 0 deletions

4
net.c
View File

@ -63,6 +63,10 @@ int redisNetRead(redisContext *c, char *buf, size_t bufcap) {
if ((errno == EWOULDBLOCK && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
/* Try again later */
return 0;
} else if(errno == ETIMEDOUT && (c->flags & REDIS_BLOCK)) {
/* especially in windows */
__redisSetError(c, REDIS_ERR_TIMEOUT, "recv timeout");
return -1;
} else {
__redisSetError(c, REDIS_ERR_IO, NULL);
return -1;