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/location.h" | 7 #include "base/location.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 state_ = STATE_TLS_CONNECTING; | 160 state_ = STATE_TLS_CONNECTING; |
161 int status = socket_->Connect( | 161 int status = socket_->Connect( |
162 base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, | 162 base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, |
163 base::Unretained(this))); | 163 base::Unretained(this))); |
164 if (status != net::ERR_IO_PENDING) { | 164 if (status != net::ERR_IO_PENDING) { |
165 ProcessTlsSslConnectDone(status); | 165 ProcessTlsSslConnectDone(status); |
166 } | 166 } |
167 } else { | 167 } else { |
168 // If we are not doing TLS, we are ready to send data now. | 168 // If we are not doing TLS, we are ready to send data now. |
169 // In case of TLS, SignalConnect will be sent only after TLS handshake is | 169 // In case of TLS, SignalConnect will be sent only after TLS handshake is |
170 // successfull. So no buffering will be done at socket handlers if any | 170 // successful. So no buffering will be done at socket handlers if any |
171 // packets sent before that by the application. | 171 // packets sent before that by the application. |
172 OnOpen(); | 172 OnOpen(); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void P2PSocketHostTcpBase::StartTls() { | 176 void P2PSocketHostTcpBase::StartTls() { |
177 DCHECK_EQ(state_, STATE_TLS_CONNECTING); | 177 DCHECK_EQ(state_, STATE_TLS_CONNECTING); |
178 DCHECK(socket_.get()); | 178 DCHECK(socket_.get()); |
179 | 179 |
180 scoped_ptr<net::ClientSocketHandle> socket_handle( | 180 scoped_ptr<net::ClientSocketHandle> socket_handle( |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } else { | 629 } else { |
630 packet_size += kTurnChannelDataHeaderSize; | 630 packet_size += kTurnChannelDataHeaderSize; |
631 // Calculate any padding if present. | 631 // Calculate any padding if present. |
632 if (packet_size % 4) | 632 if (packet_size % 4) |
633 *pad_bytes = 4 - packet_size % 4; | 633 *pad_bytes = 4 - packet_size % 4; |
634 } | 634 } |
635 return packet_size; | 635 return packet_size; |
636 } | 636 } |
637 | 637 |
638 } // namespace content | 638 } // namespace content |
OLD | NEW |