Commit e713dc5a authored by Matt Stancliff's avatar Matt Stancliff Committed by antirez
Browse files

Sentinel: Abort Hello quicker if not connected

We can save a little work by aborting when we enter the function
if we're disconnected.
parent 98bd223e
...@@ -2216,9 +2216,10 @@ int sentinelSendHello(sentinelRedisInstance *ri) { ...@@ -2216,9 +2216,10 @@ int sentinelSendHello(sentinelRedisInstance *ri) {
sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ? ri : ri->master; sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ? ri : ri->master;
sentinelAddr *master_addr = sentinelGetCurrentMasterAddress(master); sentinelAddr *master_addr = sentinelGetCurrentMasterAddress(master);
if (ri->flags & SRI_DISCONNECTED) return REDIS_ERR;
/* Try to obtain our own IP address. */ /* Try to obtain our own IP address. */
if (anetSockName(ri->cc->c.fd,ip,sizeof(ip),NULL) == -1) return REDIS_ERR; if (anetSockName(ri->cc->c.fd,ip,sizeof(ip),NULL) == -1) return REDIS_ERR;
if (ri->flags & SRI_DISCONNECTED) return REDIS_ERR;
/* Format and send the Hello message. */ /* Format and send the Hello message. */
snprintf(payload,sizeof(payload), snprintf(payload,sizeof(payload),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment