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

Unified Diff: jingle/notifier/communicator/xmpp_connection_generator.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 | « jingle/notifier/base/chrome_async_socket.cc ('k') | net/base/address_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/communicator/xmpp_connection_generator.cc
diff --git a/jingle/notifier/communicator/xmpp_connection_generator.cc b/jingle/notifier/communicator/xmpp_connection_generator.cc
index d1a9404a3855f86a406f4c82881650337e8cb5b5..3611dae010acdd2c0586d80beae6d1e518e32472 100644
--- a/jingle/notifier/communicator/xmpp_connection_generator.cc
+++ b/jingle/notifier/communicator/xmpp_connection_generator.cc
@@ -23,7 +23,6 @@
#include "jingle/notifier/communicator/connection_options.h"
#include "jingle/notifier/communicator/connection_settings.h"
#include "net/base/net_errors.h"
-#include "net/base/sys_addrinfo.h"
#include "talk/base/httpcommon-inl.h"
#include "talk/base/task.h"
#include "talk/base/thread.h"
@@ -156,17 +155,17 @@ void XmppConnectionGenerator::HandleServerDNSResolved(int status) {
}
// Slurp the addresses into a vector.
- std::vector<uint32> ip_list;
- for (const addrinfo* addr = address_list_.head();
- addr != NULL; addr = addr->ai_next) {
- const sockaddr_in& sockaddr =
- *reinterpret_cast<const sockaddr_in*>(addr->ai_addr);
- uint32 ip = talk_base::NetworkToHost32(sockaddr.sin_addr.s_addr);
+ std::vector<uint32> ip_list; // TODO(szym): not IPv6-safe.
+ for (size_t i = 0; i < address_list_.size(); ++i) {
+ const net::IPEndPoint& addr = address_list_[i];
+ DCHECK_EQ(addr.GetFamily(), AF_INET);
+ uint32 ip = talk_base::NetworkToHost32(
+ *reinterpret_cast<const uint32*>(&addr.address()[0]));
ip_list.push_back(ip);
}
successfully_resolved_dns_ = !ip_list.empty();
- for (int i = 0; i < static_cast<int>(ip_list.size()); ++i) {
+ for (size_t i = 0; i < ip_list.size(); ++i) {
VLOG(1) << " ip " << i
<< " : " << talk_base::SocketAddress::IPToString(ip_list[i]);
}
« no previous file with comments | « jingle/notifier/base/chrome_async_socket.cc ('k') | net/base/address_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698