mirror of https://gitee.com/bigwinds/arangodb
bugfix IPv6 endpoint
This commit is contained in:
parent
f89ff94944
commit
5c3e10de70
|
@ -195,12 +195,12 @@ Endpoint* Endpoint::factory (const Endpoint::EndpointType type,
|
||||||
|
|
||||||
if (copy[0] == '[') {
|
if (copy[0] == '[') {
|
||||||
// ipv6
|
// ipv6
|
||||||
found = copy.find("]:", 1);
|
found = copy.find("]:", 1);
|
||||||
if (found != string::npos && found + 2 < copy.size()) {
|
if (found != string::npos && found > 2 && found + 2 < copy.size()) {
|
||||||
// hostname and port (e.g. [address]:port)
|
// hostname and port (e.g. [address]:port)
|
||||||
uint16_t port = (uint16_t) StringUtils::uint32(copy.substr(found + 2));
|
uint16_t port = (uint16_t) StringUtils::uint32(copy.substr(found + 2));
|
||||||
|
|
||||||
return new EndpointIpV6(type, protocol, encryption, specification, listenBacklog, copy.substr(0, found + 1), port);
|
return new EndpointIpV6(type, protocol, encryption, specification, listenBacklog, copy.substr(1, found - 1), port);
|
||||||
}
|
}
|
||||||
|
|
||||||
found = copy.find("]", 1);
|
found = copy.find("]", 1);
|
||||||
|
@ -501,7 +501,7 @@ EndpointIp::EndpointIp (const Endpoint::EndpointType type,
|
||||||
const std::string& host,
|
const std::string& host,
|
||||||
const uint16_t port) :
|
const uint16_t port) :
|
||||||
Endpoint(type, domainType, protocol, encryption, specification, listenBacklog), _host(host), _port(port) {
|
Endpoint(type, domainType, protocol, encryption, specification, listenBacklog), _host(host), _port(port) {
|
||||||
|
|
||||||
assert(domainType == DOMAIN_IPV4 || domainType == Endpoint::DOMAIN_IPV6);
|
assert(domainType == DOMAIN_IPV4 || domainType == Endpoint::DOMAIN_IPV6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue