From cec1f281b1d9bbe6658c045368c4f365b47ba938 Mon Sep 17 00:00:00 2001 From: vin01 Date: Tue, 3 Sep 2019 16:52:52 +0200 Subject: [PATCH] Reset error flag for the rediscontext struct --- deps/hiredis/net.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/deps/hiredis/net.c b/deps/hiredis/net.c index 547c640acbc8e..8416b103e5ea0 100644 --- a/deps/hiredis/net.c +++ b/deps/hiredis/net.c @@ -411,6 +411,15 @@ static int _redisContextConnectTcp(redisContext *c, const char *addr, int port, c->flags |= REDIS_CONNECTED; + /* This is needed because c->err is set using __redisSetError on + * connection failures. This can be called by various functions. + * We shall have a clear function that would ideally clean the struct + * of all past errors which have been put into or somehow only set the + * error flag and message after looping through all IP addresses and + * not finding any REDIS_OK. + */ + c->err = 0; + freeaddrinfo(servinfo); return REDIS_OK; // Need to return REDIS_OK if alright }