| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/renderer_host/p2p/socket_host.h" | 10 #include "content/browser/renderer_host/p2p/socket_host.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 void P2PSocketDispatcherHost::OnAcceptIncomingTcpConnection( | 259 void P2PSocketDispatcherHost::OnAcceptIncomingTcpConnection( |
| 260 int listen_socket_id, const net::IPEndPoint& remote_address, | 260 int listen_socket_id, const net::IPEndPoint& remote_address, |
| 261 int connected_socket_id) { | 261 int connected_socket_id) { |
| 262 P2PSocketHost* socket = LookupSocket(listen_socket_id); | 262 P2PSocketHost* socket = LookupSocket(listen_socket_id); |
| 263 if (!socket) { | 263 if (!socket) { |
| 264 LOG(ERROR) << "Received P2PHostMsg_AcceptIncomingTcpConnection " | 264 LOG(ERROR) << "Received P2PHostMsg_AcceptIncomingTcpConnection " |
| 265 "for invalid socket_id."; | 265 "for invalid listen_socket_id."; |
| 266 return; | 266 return; |
| 267 } | 267 } |
| 268 if (LookupSocket(connected_socket_id) != NULL) { |
| 269 LOG(ERROR) << "Received P2PHostMsg_AcceptIncomingTcpConnection " |
| 270 "for duplicated connected_socket_id."; |
| 271 return; |
| 272 } |
| 273 |
| 268 P2PSocketHost* accepted_connection = | 274 P2PSocketHost* accepted_connection = |
| 269 socket->AcceptIncomingTcpConnection(remote_address, connected_socket_id); | 275 socket->AcceptIncomingTcpConnection(remote_address, connected_socket_id); |
| 270 if (accepted_connection) { | 276 if (accepted_connection) { |
| 271 sockets_[connected_socket_id] = accepted_connection; | 277 sockets_[connected_socket_id] = accepted_connection; |
| 272 } | 278 } |
| 273 } | 279 } |
| 274 | 280 |
| 275 void P2PSocketDispatcherHost::OnSend(int socket_id, | 281 void P2PSocketDispatcherHost::OnSend(int socket_id, |
| 276 const net::IPEndPoint& socket_address, | 282 const net::IPEndPoint& socket_address, |
| 277 const std::vector<char>& data, | 283 const std::vector<char>& data, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 357 |
| 352 if (!dump_incoming_rtp_packet_ && !dump_outgoing_rtp_packet_) | 358 if (!dump_incoming_rtp_packet_ && !dump_outgoing_rtp_packet_) |
| 353 packet_callback_.Reset(); | 359 packet_callback_.Reset(); |
| 354 | 360 |
| 355 for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it) | 361 for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it) |
| 356 it->second->StopRtpDump(incoming, outgoing); | 362 it->second->StopRtpDump(incoming, outgoing); |
| 357 } | 363 } |
| 358 } | 364 } |
| 359 | 365 |
| 360 } // namespace content | 366 } // namespace content |
| OLD | NEW |