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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 P2PSocketHost* accepted_connection = | 224 P2PSocketHost* accepted_connection = |
225 socket->AcceptIncomingTcpConnection(remote_address, connected_socket_id); | 225 socket->AcceptIncomingTcpConnection(remote_address, connected_socket_id); |
226 if (accepted_connection) { | 226 if (accepted_connection) { |
227 sockets_[connected_socket_id] = accepted_connection; | 227 sockets_[connected_socket_id] = accepted_connection; |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 void P2PSocketDispatcherHost::OnSend(int socket_id, | 231 void P2PSocketDispatcherHost::OnSend(int socket_id, |
232 const net::IPEndPoint& socket_address, | 232 const net::IPEndPoint& socket_address, |
233 const std::vector<char>& data, | 233 const std::vector<char>& data, |
234 const talk_base::PacketOptions& options, | 234 net::DiffServCodePoint dscp, |
235 uint64 packet_id) { | 235 uint64 packet_id) { |
236 P2PSocketHost* socket = LookupSocket(socket_id); | 236 P2PSocketHost* socket = LookupSocket(socket_id); |
237 if (!socket) { | 237 if (!socket) { |
238 LOG(ERROR) << "Received P2PHostMsg_Send for invalid socket_id."; | 238 LOG(ERROR) << "Received P2PHostMsg_Send for invalid socket_id."; |
239 return; | 239 return; |
240 } | 240 } |
241 | 241 |
242 if (data.size() > kMaximumPacketSize) { | 242 if (data.size() > kMaximumPacketSize) { |
243 LOG(ERROR) << "Received P2PHostMsg_Send with a packet that is too big: " | 243 LOG(ERROR) << "Received P2PHostMsg_Send with a packet that is too big: " |
244 << data.size(); | 244 << data.size(); |
245 Send(new P2PMsg_OnError(socket_id)); | 245 Send(new P2PMsg_OnError(socket_id)); |
246 delete socket; | 246 delete socket; |
247 sockets_.erase(socket_id); | 247 sockets_.erase(socket_id); |
248 return; | 248 return; |
249 } | 249 } |
250 | 250 |
251 socket->Send(socket_address, data, options, packet_id); | 251 socket->Send(socket_address, data, dscp, packet_id); |
252 } | 252 } |
253 | 253 |
254 void P2PSocketDispatcherHost::OnSetOption(int socket_id, | 254 void P2PSocketDispatcherHost::OnSetOption(int socket_id, |
255 P2PSocketOption option, | 255 P2PSocketOption option, |
256 int value) { | 256 int value) { |
257 P2PSocketHost* socket = LookupSocket(socket_id); | 257 P2PSocketHost* socket = LookupSocket(socket_id); |
258 if (!socket) { | 258 if (!socket) { |
259 LOG(ERROR) << "Received P2PHostMsg_SetOption for invalid socket_id."; | 259 LOG(ERROR) << "Received P2PHostMsg_SetOption for invalid socket_id."; |
260 return; | 260 return; |
261 } | 261 } |
(...skipping 27 matching lines...) Expand all Loading... |
289 void P2PSocketDispatcherHost::OnAddressResolved( | 289 void P2PSocketDispatcherHost::OnAddressResolved( |
290 DnsRequest* request, | 290 DnsRequest* request, |
291 const net::IPAddressList& addresses) { | 291 const net::IPAddressList& addresses) { |
292 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); | 292 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); |
293 | 293 |
294 dns_requests_.erase(request); | 294 dns_requests_.erase(request); |
295 delete request; | 295 delete request; |
296 } | 296 } |
297 | 297 |
298 } // namespace content | 298 } // namespace content |
OLD | NEW |