diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-20 18:50:38 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-20 18:50:38 +0000 |
commit | ac9eec64de86f3d3a290a1a8b9321260cff7ed23 (patch) | |
tree | aac041c6ddaec400b6e2b6d3d982935aa7f69a9c /chrome/browser/sync | |
parent | 8c1ae5ec4d47638315096f54819793484383c91f (diff) | |
download | chromium_src-ac9eec64de86f3d3a290a1a8b9321260cff7ed23.zip chromium_src-ac9eec64de86f3d3a290a1a8b9321260cff7ed23.tar.gz chromium_src-ac9eec64de86f3d3a290a1a8b9321260cff7ed23.tar.bz2 |
Really connect to the same server in FTP network transaction.
Also create necessary infrastructure to know the address
a client socket is connected to.
TEST=Covered by net_unittests.
BUG=35670
Review URL: http://codereview.chromium.org/598071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rwxr-xr-x | chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc | 23 | ||||
-rwxr-xr-x | chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h | 2 |
2 files changed, 20 insertions, 5 deletions
diff --git a/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc b/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc index 414cc79..1a5619c 100755 --- a/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc +++ b/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc @@ -8,8 +8,10 @@ #include "base/message_loop.h" #include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/profile.h" +#include "net/base/address_list.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" @@ -254,10 +256,23 @@ bool TransportSocket::IsConnectedAndIdle() const { return false; } -int TransportSocket::GetPeerName(struct sockaddr* name, socklen_t* namelen) { - talk_base::SocketAddress address = socket_->GetRemoteAddress(); - address.ToSockAddr(reinterpret_cast<sockaddr_in *>(name)); - return 0; +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, sizeof(ai), 0); + 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->Copy(&ai, false); + return net::OK; } int TransportSocket::Read(net::IOBuffer* buf, int buf_len, diff --git a/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h b/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h index fe869fe..12dfc74 100755 --- a/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h +++ b/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h @@ -42,7 +42,7 @@ class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; - virtual int GetPeerName(struct sockaddr* name, socklen_t* namelen); + virtual int GetPeerAddress(net::AddressList* address) const; // net::Socket implementation |