Merge pull request #2096 from mattsta/cluster-ipv6
Enable Cluster IPv6 Support
This commit is contained in:
commit
5a526c22cc
@ -178,7 +178,7 @@ int clusterLoadConfig(char *filename) {
|
||||
clusterAddNode(n);
|
||||
}
|
||||
/* Address and port */
|
||||
if ((p = strchr(argv[1],':')) == NULL) goto fmterr;
|
||||
if ((p = strrchr(argv[1],':')) == NULL) goto fmterr;
|
||||
*p = '\0';
|
||||
memcpy(n->ip,argv[1],strlen(argv[1])+1);
|
||||
n->port = atoi(p+1);
|
||||
|
@ -50,14 +50,16 @@ end
|
||||
class ClusterNode
|
||||
def initialize(addr)
|
||||
s = addr.split(":")
|
||||
if s.length != 2
|
||||
puts "Invalid node name #{addr}"
|
||||
exit 1
|
||||
if s.length < 2
|
||||
puts "Invalid IP or Port (given as #{addr}) - use IP:Port format"
|
||||
exit 1
|
||||
end
|
||||
port = s.pop # removes port from split array
|
||||
ip = s.join(":") # if s.length > 1 here, it's IPv6, so restore address
|
||||
@r = nil
|
||||
@info = {}
|
||||
@info[:host] = s[0]
|
||||
@info[:port] = s[1]
|
||||
@info[:host] = ip
|
||||
@info[:port] = port
|
||||
@info[:slots] = {}
|
||||
@info[:migrating] = {}
|
||||
@info[:importing] = {}
|
||||
|
Loading…
Reference in New Issue
Block a user