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