Merge pull request #42 from mosquito/master

[fix] ipv6 address parsing
This commit is contained in:
fortrue 2018-07-05 08:15:04 -05:00 committed by GitHub
commit 0635178c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,7 +102,7 @@ void Socket::getFirstAddr(const char* addr, int type, int protocol, sockaddr* re
} else { } else {
std::string tmp; std::string tmp;
const char* host = addr; const char* host = addr;
const char* port = strchr(addr, ':'); const char* port = strrchr(addr, ':');
if (port) { if (port) {
tmp.append(addr, port - addr); tmp.append(addr, port - addr);
host = tmp.c_str(); host = tmp.c_str();