OLD | NEW |
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/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 resource_context_->GetHostResolver()); | 186 resource_context_->GetHostResolver()); |
187 dns_requests_.insert(request); | 187 dns_requests_.insert(request); |
188 request->Resolve(host_name, base::Bind( | 188 request->Resolve(host_name, base::Bind( |
189 &P2PSocketDispatcherHost::OnAddressResolved, | 189 &P2PSocketDispatcherHost::OnAddressResolved, |
190 base::Unretained(this), request)); | 190 base::Unretained(this), request)); |
191 } | 191 } |
192 | 192 |
193 void P2PSocketDispatcherHost::OnCreateSocket( | 193 void P2PSocketDispatcherHost::OnCreateSocket( |
194 P2PSocketType type, int socket_id, | 194 P2PSocketType type, int socket_id, |
195 const net::IPEndPoint& local_address, | 195 const net::IPEndPoint& local_address, |
196 const net::IPEndPoint& remote_address) { | 196 const P2PHostAndIPEndPoint& remote_address) { |
197 if (LookupSocket(socket_id)) { | 197 if (LookupSocket(socket_id)) { |
198 LOG(ERROR) << "Received P2PHostMsg_CreateSocket for socket " | 198 LOG(ERROR) << "Received P2PHostMsg_CreateSocket for socket " |
199 "that already exists."; | 199 "that already exists."; |
200 return; | 200 return; |
201 } | 201 } |
202 | 202 |
203 scoped_ptr<P2PSocketHost> socket(P2PSocketHost::Create( | 203 scoped_ptr<P2PSocketHost> socket(P2PSocketHost::Create( |
204 this, socket_id, type, url_context_.get(), &throttler_)); | 204 this, socket_id, type, url_context_.get(), &throttler_)); |
205 | 205 |
206 if (!socket) { | 206 if (!socket) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 void P2PSocketDispatcherHost::OnAddressResolved( | 290 void P2PSocketDispatcherHost::OnAddressResolved( |
291 DnsRequest* request, | 291 DnsRequest* request, |
292 const net::IPAddressList& addresses) { | 292 const net::IPAddressList& addresses) { |
293 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); | 293 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); |
294 | 294 |
295 dns_requests_.erase(request); | 295 dns_requests_.erase(request); |
296 delete request; | 296 delete request; |
297 } | 297 } |
298 | 298 |
299 } // namespace content | 299 } // namespace content |
OLD | NEW |