Fix host-port splitter in SentinelConnectionManager for ipv6 addresses

pull/1724/head
Mikhail Surin 6 years ago
parent a71460624e
commit 0e74a8f1b0

@ -371,8 +371,11 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager {
Set<String> removedSlaves = new HashSet<String>(slaves); Set<String> removedSlaves = new HashSet<String>(slaves);
removedSlaves.removeAll(currentSlaves); removedSlaves.removeAll(currentSlaves);
for (String slave : removedSlaves) { for (String slave : removedSlaves) {
String[] parts = slave.replace("redis://", "").split(":"); String hostPort = slave.replace("redis://", "");
slaveDown(parts[0], parts[1]); int lastColonIdx = hostPort.lastIndexOf(":");
String host = hostPort.substring(0, lastColonIdx);
String port = hostPort.substring(lastColonIdx + 1);
slaveDown(host, port);
} }
}; };
}; };

Loading…
Cancel
Save