diff options
author | michael-grunder <michael.grunder@gmail.com> | 2023-04-14 12:47:47 -0700 |
---|---|---|
committer | Michael Grunder <michael.grunder@gmail.com> | 2023-04-14 23:02:01 -0700 |
commit | 3f95fcdae4d13dd234aea1d1b7f0af50efb79219 (patch) | |
tree | 1306fd35fd302f850c866622eff3ac921a6345af | |
parent | aacb84b8d403c179803a7472c6804eddd39b0a23 (diff) |
Don't attempt to set a timeout if we are in an error state.
-rw-r--r-- | hiredis.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -860,7 +860,9 @@ redisContext *redisConnectWithOptions(const redisOptions *options) { return NULL; } - if (options->command_timeout != NULL && (c->flags & REDIS_BLOCK) && c->fd != REDIS_INVALID_FD) { + if (c->err == 0 && c->fd != REDIS_INVALID_FD && + options->command_timeout != NULL && (c->flags & REDIS_BLOCK)) + { redisContextSetTimeout(c, *options->command_timeout); } |