| 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_host_tcp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 6 | 6 |
| 7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
| 8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
| 9 #include "ipc/ipc_sender.h" | 9 #include "ipc/ipc_sender.h" |
| 10 #include "jingle/glue/fake_ssl_client_socket.h" | 10 #include "jingle/glue/fake_ssl_client_socket.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 << " before STUN binding is finished. " | 264 << " before STUN binding is finished. " |
| 265 << "Terminating connection."; | 265 << "Terminating connection."; |
| 266 OnError(); | 266 OnError(); |
| 267 return; | 267 return; |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 message_sender_->Send(new P2PMsg_OnDataReceived(id_, remote_address_, data)); | 271 message_sender_->Send(new P2PMsg_OnDataReceived(id_, remote_address_, data)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // Note: dscp is not actually used on TCP sockets as this point, |
| 275 // but may be honored in the future. |
| 274 void P2PSocketHostTcpBase::Send(const net::IPEndPoint& to, | 276 void P2PSocketHostTcpBase::Send(const net::IPEndPoint& to, |
| 275 const std::vector<char>& data, | 277 const std::vector<char>& data, |
| 278 net::DiffServCodePoint dscp, |
| 276 uint64 packet_id) { | 279 uint64 packet_id) { |
| 277 if (!socket_) { | 280 if (!socket_) { |
| 278 // The Send message may be sent after the an OnError message was | 281 // The Send message may be sent after the an OnError message was |
| 279 // sent by hasn't been processed the renderer. | 282 // sent by hasn't been processed the renderer. |
| 280 return; | 283 return; |
| 281 } | 284 } |
| 282 | 285 |
| 283 if (!(to == remote_address_)) { | 286 if (!(to == remote_address_)) { |
| 284 // Renderer should use this socket only to send data to |remote_address_|. | 287 // Renderer should use this socket only to send data to |remote_address_|. |
| 285 NOTREACHED(); | 288 NOTREACHED(); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } else { | 515 } else { |
| 513 packet_size += kTurnChannelDataHeaderSize; | 516 packet_size += kTurnChannelDataHeaderSize; |
| 514 // Calculate any padding if present. | 517 // Calculate any padding if present. |
| 515 if (packet_size % 4) | 518 if (packet_size % 4) |
| 516 *pad_bytes = 4 - packet_size % 4; | 519 *pad_bytes = 4 - packet_size % 4; |
| 517 } | 520 } |
| 518 return packet_size; | 521 return packet_size; |
| 519 } | 522 } |
| 520 | 523 |
| 521 } // namespace content | 524 } // namespace content |
| OLD | NEW |