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

Side by Side Diff: content/browser/renderer_host/p2p/socket_dispatcher_host.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" 5 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/renderer_host/p2p/socket_host.h" 9 #include "content/browser/renderer_host/p2p/socket_host.h"
10 #include "content/public/browser/resource_context.h" 10 #include "content/public/browser/resource_context.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 private: 66 private:
67 void OnDone(int result) { 67 void OnDone(int result) {
68 if (result != net::OK) { 68 if (result != net::OK) {
69 LOG(ERROR) << "Failed to resolve address for " << host_name_ 69 LOG(ERROR) << "Failed to resolve address for " << host_name_
70 << ", errorcode: " << result; 70 << ", errorcode: " << result;
71 done_callback_.Run(net::IPAddressNumber()); 71 done_callback_.Run(net::IPAddressNumber());
72 return; 72 return;
73 } 73 }
74 74
75 if (addresses_.head() == NULL) { 75 // TODO(szym): Redundant check. http://crbug.com/126211
76 if (addresses_.empty()) {
76 LOG(ERROR) << "Received 0 addresses when trying to resolve address for " 77 LOG(ERROR) << "Received 0 addresses when trying to resolve address for "
77 << host_name_; 78 << host_name_;
78 done_callback_.Run(net::IPAddressNumber()); 79 done_callback_.Run(net::IPAddressNumber());
79 return; 80 return;
80 } 81 }
81 82
82 net::IPEndPoint end_point; 83 done_callback_.Run(addresses_.front().address());
83 if (!end_point.FromSockAddr(addresses_.head()->ai_addr,
84 addresses_.head()->ai_addrlen)) {
85 LOG(ERROR) << "Received invalid address for " << host_name_;
86 done_callback_.Run(net::IPAddressNumber());
87 return;
88 }
89
90 done_callback_.Run(end_point.address());
91 } 84 }
92 85
93 int32 routing_id_; 86 int32 routing_id_;
94 int32 request_id_; 87 int32 request_id_;
95 net::AddressList addresses_; 88 net::AddressList addresses_;
96 89
97 std::string host_name_; 90 std::string host_name_;
98 net::SingleRequestHostResolver resolver_; 91 net::SingleRequestHostResolver resolver_;
99 92
100 DoneCallback done_callback_; 93 DoneCallback done_callback_;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 DnsRequest* request, 273 DnsRequest* request,
281 const net::IPAddressNumber& result) { 274 const net::IPAddressNumber& result) {
282 Send(new P2PMsg_GetHostAddressResult( 275 Send(new P2PMsg_GetHostAddressResult(
283 request->routing_id(), request->request_id(), result)); 276 request->routing_id(), request->request_id(), result));
284 277
285 dns_requests_.erase(request); 278 dns_requests_.erase(request);
286 delete request; 279 delete request;
287 } 280 }
288 281
289 } // namespace content 282 } // namespace content
OLDNEW
« no previous file with comments | « chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp ('k') | content/browser/renderer_host/p2p/socket_host_tcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698