mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Sentinel: Abort Hello quicker if not connected
We can save a little work by aborting when we enter the function if we're disconnected.
This commit is contained in:
parent
a23502e5e8
commit
67e414c7b8
@ -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),
|
||||||
|
Loading…
Reference in New Issue
Block a user