Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Unified Diff: net/socket/socks_client_socket.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | net/socket/ssl_client_socket_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socks_client_socket.cc
diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc
index 01983d916b67e018dc080e4a0c6905df1ba32624..025d1aa242acddbc92875e87dec16a184d333a01 100644
--- a/net/socket/socks_client_socket.cc
+++ b/net/socket/socks_client_socket.cc
@@ -11,7 +11,6 @@
#include "net/base/io_buffer.h"
#include "net/base/net_log.h"
#include "net/base/net_util.h"
-#include "net/base/sys_addrinfo.h"
#include "net/socket/client_socket_handle.h"
namespace net {
@@ -307,20 +306,19 @@ const std::string SOCKSClientSocket::BuildHandshakeWriteBuffer() const {
request.command = kSOCKSStreamRequest;
request.nw_port = base::HostToNet16(host_request_info_.port());
- const struct addrinfo* ai = addresses_.head();
- DCHECK(ai);
+ DCHECK(!addresses_.empty());
+ const IPEndPoint& endpoint = addresses_.front();
// We disabled IPv6 results when resolving the hostname, so none of the
// results in the list will be IPv6.
// TODO(eroman): we only ever use the first address in the list. It would be
// more robust to try all the IP addresses we have before
// failing the connect attempt.
- CHECK_EQ(AF_INET, ai->ai_addr->sa_family);
- struct sockaddr_in* ipv4_host =
- reinterpret_cast<struct sockaddr_in*>(ai->ai_addr);
- memcpy(&request.ip, &ipv4_host->sin_addr, sizeof(ipv4_host->sin_addr));
+ CHECK_EQ(AF_INET, endpoint.GetFamily());
+ CHECK_LE(endpoint.address().size(), sizeof(request.ip));
+ memcpy(&request.ip, &endpoint.address()[0], endpoint.address().size());
- DVLOG(1) << "Resolved Host is : " << NetAddressToString(ai);
+ DVLOG(1) << "Resolved Host is : " << endpoint.ToStringWithoutPort();
std::string handshake_data(reinterpret_cast<char*>(&request),
sizeof(request));
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | net/socket/ssl_client_socket_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698