summaryrefslogtreecommitdiffstats
path: root/remoting/jingle_glue/ssl_socket_adapter.cc
diff options
context:
space:
mode:
authorszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-07 21:44:56 +0000
committerszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-07 21:44:56 +0000
commit7054e78fe6a2fcda72b06dc196b5f91cfdc75872 (patch)
tree2efdd9b07a784a17905d737df9b762d88a6cd1c4 /remoting/jingle_glue/ssl_socket_adapter.cc
parentcd46545164adf645d744f3955b256cf89412cdc6 (diff)
downloadchromium_src-7054e78fe6a2fcda72b06dc196b5f91cfdc75872.zip
chromium_src-7054e78fe6a2fcda72b06dc196b5f91cfdc75872.tar.gz
chromium_src-7054e78fe6a2fcda72b06dc196b5f91cfdc75872.tar.bz2
Reimplements net::AddressList without struct addrinfo.
net::AddressList extends std::vector<std::IPEndPoint> by canonical name. (Canonical name is planned to be removed as well.) Removes dependency on sys_addrinfo.h throughout the codebase. Introduces net::SockaddrStorage for convenience. BUG=125696 TEST=green waterfall Review URL: http://codereview.chromium.org/10309002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue/ssl_socket_adapter.cc')
-rw-r--r--remoting/jingle_glue/ssl_socket_adapter.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/remoting/jingle_glue/ssl_socket_adapter.cc b/remoting/jingle_glue/ssl_socket_adapter.cc
index 5966396..b6b530d 100644
--- a/remoting/jingle_glue/ssl_socket_adapter.cc
+++ b/remoting/jingle_glue/ssl_socket_adapter.cc
@@ -13,7 +13,6 @@
#include "net/base/host_port_pair.h"
#include "net/base/net_errors.h"
#include "net/base/ssl_config_service.h"
-#include "net/base/sys_addrinfo.h"
#include "net/socket/client_socket_factory.h"
#include "net/url_request/url_request_context.h"
@@ -220,21 +219,13 @@ bool TransportSocket::IsConnectedAndIdle() const {
int TransportSocket::GetPeerAddress(net::AddressList* address) const {
talk_base::SocketAddress socket_address = socket_->GetRemoteAddress();
-
- // libjingle supports only IPv4 addresses.
- sockaddr_in ipv4addr;
- socket_address.ToSockAddr(&ipv4addr);
-
- struct addrinfo ai;
- memset(&ai, 0, sizeof(ai));
- ai.ai_family = ipv4addr.sin_family;
- ai.ai_socktype = SOCK_STREAM;
- ai.ai_protocol = IPPROTO_TCP;
- ai.ai_addr = reinterpret_cast<struct sockaddr*>(&ipv4addr);
- ai.ai_addrlen = sizeof(ipv4addr);
-
- *address = net::AddressList::CreateByCopyingFirstAddress(&ai);
- return net::OK;
+ net::IPEndPoint endpoint;
+ if (jingle_glue::SocketAddressToIPEndPoint(socket_address, &endpoint)) {
+ *address = net::AddressList(endpoint);
+ return net::OK;
+ } else {
+ return net::ERR_FAILED;
+ }
}
int TransportSocket::GetLocalAddress(net::IPEndPoint* address) const {