mirror of
https://github.com/fluencelabs/redis
synced 2025-05-05 15:32:14 +00:00
Sentinel: check that instance still exists in reply callbacks.
We can't be sure the instance object still exists when the reply callback is called.
This commit is contained in:
parent
d876d6feac
commit
2179c26916
@ -1145,8 +1145,8 @@ void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata
|
|||||||
sentinelRedisInstance *ri = c->data;
|
sentinelRedisInstance *ri = c->data;
|
||||||
redisReply *r;
|
redisReply *r;
|
||||||
|
|
||||||
ri->pending_commands--;
|
if (ri) ri->pending_commands--;
|
||||||
if (!reply) return;
|
if (!reply || !ri) return;
|
||||||
r = reply;
|
r = reply;
|
||||||
|
|
||||||
if (r->type == REDIS_REPLY_STRING) {
|
if (r->type == REDIS_REPLY_STRING) {
|
||||||
@ -1159,15 +1159,15 @@ void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata
|
|||||||
void sentinelDiscardReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
|
void sentinelDiscardReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
|
||||||
sentinelRedisInstance *ri = c->data;
|
sentinelRedisInstance *ri = c->data;
|
||||||
|
|
||||||
ri->pending_commands--;
|
if (ri) ri->pending_commands--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
|
void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata) {
|
||||||
sentinelRedisInstance *ri = c->data;
|
sentinelRedisInstance *ri = c->data;
|
||||||
redisReply *r;
|
redisReply *r;
|
||||||
|
|
||||||
ri->pending_commands--;
|
if (ri) ri->pending_commands--;
|
||||||
if (!reply) return;
|
if (!reply || !ri) return;
|
||||||
r = reply;
|
r = reply;
|
||||||
|
|
||||||
if (r->type == REDIS_REPLY_STATUS ||
|
if (r->type == REDIS_REPLY_STATUS ||
|
||||||
@ -1190,8 +1190,8 @@ void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privd
|
|||||||
sentinelRedisInstance *ri = c->data;
|
sentinelRedisInstance *ri = c->data;
|
||||||
redisReply *r;
|
redisReply *r;
|
||||||
|
|
||||||
ri->pending_commands--;
|
if (ri) ri->pending_commands--;
|
||||||
if (!reply) return;
|
if (!reply || !ri) return;
|
||||||
r = reply;
|
r = reply;
|
||||||
|
|
||||||
/* Only update pub_time if we actually published our message. Otherwise
|
/* Only update pub_time if we actually published our message. Otherwise
|
||||||
@ -1206,7 +1206,7 @@ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privd
|
|||||||
sentinelRedisInstance *ri = c->data;
|
sentinelRedisInstance *ri = c->data;
|
||||||
redisReply *r;
|
redisReply *r;
|
||||||
|
|
||||||
if (!reply) return;
|
if (!reply || !ri) return;
|
||||||
r = reply;
|
r = reply;
|
||||||
|
|
||||||
/* Update the last activity in the pubsub channel. Note that since we
|
/* Update the last activity in the pubsub channel. Note that since we
|
||||||
@ -1700,8 +1700,8 @@ void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *p
|
|||||||
sentinelRedisInstance *ri = c->data;
|
sentinelRedisInstance *ri = c->data;
|
||||||
redisReply *r;
|
redisReply *r;
|
||||||
|
|
||||||
ri->pending_commands--;
|
if (ri) ri->pending_commands--;
|
||||||
if (!reply) return;
|
if (!reply || !ri) return;
|
||||||
r = reply;
|
r = reply;
|
||||||
|
|
||||||
/* Ignore every error or unexpected reply.
|
/* Ignore every error or unexpected reply.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user