From 8e61d5737a9123549298582a7b98207e2acd7f7c Mon Sep 17 00:00:00 2001 From: Sangmoon Yi Date: Mon, 12 Aug 2019 10:55:08 +0900 Subject: [PATCH] add recv error code for clarifying timeout --- net.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net.c b/net.c index 6e7ac82..7cbfd32 100644 --- a/net.c +++ b/net.c @@ -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;