This is our Pub/Sub callback for the Hello channel. It's useful in order * to discover other sentinels attached at the same master. */
| 2961 | /* This is our Pub/Sub callback for the Hello channel. It's useful in order |
| 2962 | * to discover other sentinels attached at the same master. */ |
| 2963 | void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privdata) { |
| 2964 | sentinelRedisInstance *ri = (sentinelRedisInstance*)privdata; |
| 2965 | redisReply *r; |
| 2966 | UNUSED(c); |
| 2967 | |
| 2968 | if (!reply || !ri) return; |
| 2969 | r = (redisReply*)reply; |
| 2970 | |
| 2971 | /* Update the last activity in the pubsub channel. Note that since we |
| 2972 | * receive our messages as well this timestamp can be used to detect |
| 2973 | * if the link is probably disconnected even if it seems otherwise. */ |
| 2974 | ri->link->pc_last_activity = mstime(); |
| 2975 | |
| 2976 | /* Sanity check in the reply we expect, so that the code that follows |
| 2977 | * can avoid to check for details. */ |
| 2978 | if (r->type != REDIS_REPLY_ARRAY || |
| 2979 | r->elements != 3 || |
| 2980 | r->element[0]->type != REDIS_REPLY_STRING || |
| 2981 | r->element[1]->type != REDIS_REPLY_STRING || |
| 2982 | r->element[2]->type != REDIS_REPLY_STRING || |
| 2983 | strcmp(r->element[0]->str,"message") != 0) return; |
| 2984 | |
| 2985 | /* We are not interested in meeting ourselves */ |
| 2986 | if (strstr(r->element[2]->str,sentinel.myid) != NULL) return; |
| 2987 | |
| 2988 | sentinelProcessHelloMessage(r->element[2]->str, r->element[2]->len); |
| 2989 | } |
| 2990 | |
| 2991 | /* Send a "Hello" message via Pub/Sub to the specified 'ri' Redis |
| 2992 | * instance in order to broadcast the current configuration for this |
nothing calls this directly
no test coverage detected