Fix IPAddress::get_ipv4 usages.

GitOrigin-RevId: 6d87c9347aaa40957b1e524f889cf9fe8b179bb1
This commit is contained in:
levlam 2018-09-11 19:40:53 +03:00
parent a80bd978e8
commit cc077a3971
2 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ void Socks5::send_ip_address() {
request += '\x00';
if (ip_address_.is_ipv4()) {
request += '\x01';
auto ipv4 = ip_address_.get_ipv4();
auto ipv4 = ntohl(ip_address_.get_ipv4());
request += static_cast<char>(ipv4 & 255);
request += static_cast<char>((ipv4 >> 8) & 255);
request += static_cast<char>((ipv4 >> 16) & 255);
@ -136,7 +136,7 @@ Status Socks5::wait_ip_address_response() {
}
it.advance(1, c_slice);
if (c != '\0') {
return Status::Error("byte must be zero");
return Status::Error("Byte must be zero");
}
it.advance(1, c_slice);
size_t total_size = 6;

View File

@ -210,7 +210,7 @@ bool IPAddress::is_ipv6() const {
uint32 IPAddress::get_ipv4() const {
CHECK(is_valid());
CHECK(is_ipv4());
return ntohl(ipv4_addr_.sin_addr.s_addr);
return htonl(ipv4_addr_.sin_addr.s_addr);
}
Slice IPAddress::get_ipv6() const {