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

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: Added missing NET_EXPORT to *PortOnAddressList. Created 8 years, 8 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
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..770904c36c4cb4d709dfd78f438c376762e37848 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,12 +155,12 @@ 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 (net::AddressList::const_iterator addr = address_list_.begin();
eroman 2012/05/04 01:08:41 Same comment as before. I recommend using an integ
+ addr != address_list_.end(); ++addr) {
+ 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();

Powered by Google App Engine
This is Rietveld 408576698