Return the current master address, that is, its address or the address * of the promoted slave if already operational. */
| 1693 | /* Return the current master address, that is, its address or the address |
| 1694 | * of the promoted slave if already operational. */ |
| 1695 | sentinelAddr *sentinelGetCurrentMasterAddress(sentinelRedisInstance *master) { |
| 1696 | /* If we are failing over the master, and the state is already |
| 1697 | * SENTINEL_FAILOVER_STATE_RECONF_SLAVES or greater, it means that we |
| 1698 | * already have the new configuration epoch in the master, and the |
| 1699 | * slave acknowledged the configuration switch. Advertise the new |
| 1700 | * address. */ |
| 1701 | if ((master->flags & SRI_FAILOVER_IN_PROGRESS) && |
| 1702 | master->promoted_slave && |
| 1703 | master->failover_state >= SENTINEL_FAILOVER_STATE_RECONF_SLAVES) |
| 1704 | { |
| 1705 | return master->promoted_slave->addr; |
| 1706 | } else { |
| 1707 | return master->addr; |
| 1708 | } |
| 1709 | } |
| 1710 | |
| 1711 | /* This function sets the down_after_period field value in 'master' to all |
| 1712 | * the slaves and sentinel instances connected to this master. */ |
no outgoing calls
no test coverage detected