From d41443bd3d87adfb32dc28ee02d3aa81e515e255 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Mon, 16 Sep 2019 17:15:34 +0300 Subject: Fix: redisReconnect() should clear SSL context. We should not attempt to keep the context and re-establish the TLS connection for several reasons: 1. Maintain symmetry between redisConnect() and redisReconnect(), so in both cases an extra step is required to initiate SSL. 2. The caller may also wish to reconfigure the SSL session and needs a chance to do that. 3. It is not a practical thing to do on an async non-blocking connection context. --- hiredis.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hiredis.c b/hiredis.c index 0658e34..c461131 100644 --- a/hiredis.c +++ b/hiredis.c @@ -708,6 +708,11 @@ int redisReconnect(redisContext *c) { c->err = 0; memset(c->errstr, '\0', strlen(c->errstr)); + if (c->privdata && c->funcs->free_privdata) { + c->funcs->free_privdata(c->privdata); + c->privdata = NULL; + } + redisNetClose(c); sdsfree(c->obuf); -- cgit v1.2.3