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

Unified Diff: net/curvecp/client_packetizer.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: net/curvecp/client_packetizer.cc
diff --git a/net/curvecp/client_packetizer.cc b/net/curvecp/client_packetizer.cc
index 4b75c6e7d57cfebfe4ff8206d3a85e40dc43390b..53890a64fdb312d27506de9af89882aea8327ac7 100644
--- a/net/curvecp/client_packetizer.cc
+++ b/net/curvecp/client_packetizer.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
-#include "net/base/sys_addrinfo.h"
#include "net/curvecp/protocol.h"
#include "net/udp/udp_client_socket.h"
@@ -33,7 +32,7 @@ ClientPacketizer::ClientPacketizer()
: Packetizer(),
next_state_(NONE),
listener_(NULL),
- current_address_(NULL),
+ current_address_index_(0),
hello_attempts_(0),
initiate_sent_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(
@@ -290,7 +289,7 @@ void ClientPacketizer::DoCallback(int result) {
int ClientPacketizer::ConnectNextAddress() {
// TODO(mbelshe): plumb Netlog information
- DCHECK(addresses_.head());
+ DCHECK(!addresses_.empty());
socket_.reset(new UDPClientSocket(DatagramSocket::DEFAULT_BIND,
RandIntCallback(),
@@ -298,17 +297,9 @@ int ClientPacketizer::ConnectNextAddress() {
NetLog::Source()));
// Rotate to next address in the list.
- if (current_address_)
- current_address_ = current_address_->ai_next;
- if (!current_address_)
- current_address_ = addresses_.head();
-
- IPEndPoint endpoint;
- if (!endpoint.FromSockAddr(current_address_->ai_addr,
- current_address_->ai_addrlen))
- return ERR_FAILED;
+ current_address_index_ = (current_address_index_ + 1) % addresses_.size();
eroman 2012/05/04 01:08:41 IMPORTANT: This isn't a direct translation. We are
szym 2012/05/04 02:38:29 Good catch!
- int rv = socket_->Connect(endpoint);
+ int rv = socket_->Connect(addresses_[current_address_index_]);
DCHECK_NE(ERR_IO_PENDING, rv);
return rv;

Powered by Google App Engine
This is Rietveld 408576698