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

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)) { if ((errno == EWOULDBLOCK && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
/* Try again later */ /* Try again later */
return 0; return 0;
} else if(errno == ETIMEDOUT && (c->flags & REDIS_BLOCK)) {
/* especially in windows */
__redisSetError(c, REDIS_ERR_TIMEOUT, "recv timeout");
return -1;
} else { } else {
__redisSetError(c, REDIS_ERR_IO, NULL); __redisSetError(c, REDIS_ERR_IO, NULL);
return -1; return -1;