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

Unified Diff: chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc

Issue 598071: Really connect to the same server in FTP network transaction. (Closed)
Patch Set: updates Created 10 years, 10 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 | « chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h ('k') | net/base/address_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc
diff --git a/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc b/chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc
index 414cc79f3159693b797afb2701bd5931b7b51f42..1a5619cf18c254e5da859aaee315c5029a40b6e5 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,
« no previous file with comments | « chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h ('k') | net/base/address_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698