diff options
author | Matt Stancliff <matt@genges.com> | 2014-08-04 13:13:12 -0400 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-09-01 16:34:06 +0200 |
commit | 67e414c7b871bced5e84f9eb9675a630ed6108dc (patch) | |
tree | baf08d259e7eda4d09d00029add107ece1dd1f62 | |
parent | a23502e5e8c55d149a3463aad845fd530b447bfd (diff) | |
download | redis-67e414c7b871bced5e84f9eb9675a630ed6108dc.tar.gz |
Sentinel: Abort Hello quicker if not connected
We can save a little work by aborting when we enter the function
if we're disconnected.
-rw-r--r-- | src/sentinel.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index 603cdd404..d26705c22 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2216,9 +2216,10 @@ int sentinelSendHello(sentinelRedisInstance *ri) { sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ? ri : ri->master; sentinelAddr *master_addr = sentinelGetCurrentMasterAddress(master); + if (ri->flags & SRI_DISCONNECTED) return REDIS_ERR; + /* Try to obtain our own IP address. */ 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. */ snprintf(payload,sizeof(payload), |