| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/p2p/p2p_transport_impl.h" | 5 #include "content/renderer/p2p/p2p_transport_impl.h" |
| 6 | 6 |
| 7 #include "content/renderer/p2p/ipc_network_manager.h" | 7 #include "content/renderer/p2p/ipc_network_manager.h" |
| 8 #include "content/renderer/p2p/ipc_socket_factory.h" | 8 #include "content/renderer/p2p/ipc_socket_factory.h" |
| 9 #include "content/renderer/p2p/port_allocator.h" | 9 #include "content/renderer/p2p/port_allocator.h" |
| 10 #include "content/renderer/render_view.h" | 10 #include "content/renderer/render_view.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 channel_adapter_.reset(new jingle_glue::TransportChannelSocketAdapter( | 86 channel_adapter_.reset(new jingle_glue::TransportChannelSocketAdapter( |
| 87 channel_.get())); | 87 channel_.get())); |
| 88 | 88 |
| 89 channel_->Connect(); | 89 channel_->Connect(); |
| 90 | 90 |
| 91 if (protocol == PROTOCOL_TCP) { | 91 if (protocol == PROTOCOL_TCP) { |
| 92 pseudo_tcp_adapter_.reset(new jingle_glue::PseudoTcpAdapter( | 92 pseudo_tcp_adapter_.reset(new jingle_glue::PseudoTcpAdapter( |
| 93 channel_adapter_.release())); | 93 channel_adapter_.release())); |
| 94 |
| 95 if (config.tcp_receive_window > 0) |
| 96 pseudo_tcp_adapter_->SetReceiveBufferSize(config.tcp_receive_window); |
| 97 if (config.tcp_send_window > 0) |
| 98 pseudo_tcp_adapter_->SetReceiveBufferSize(config.tcp_receive_window); |
| 99 pseudo_tcp_adapter_->SetNoDelay(config.tcp_no_delay); |
| 100 if (config.tcp_ack_delay_ms > 0) |
| 101 pseudo_tcp_adapter_->SetAckDelay(config.tcp_ack_delay_ms); |
| 102 |
| 94 int result = pseudo_tcp_adapter_->Connect(&connect_callback_); | 103 int result = pseudo_tcp_adapter_->Connect(&connect_callback_); |
| 95 if (result != net::ERR_IO_PENDING) | 104 if (result != net::ERR_IO_PENDING) |
| 96 OnTcpConnected(result); | 105 OnTcpConnected(result); |
| 97 } | 106 } |
| 98 | 107 |
| 99 return true; | 108 return true; |
| 100 } | 109 } |
| 101 | 110 |
| 102 bool P2PTransportImpl::AddRemoteCandidate(const std::string& address) { | 111 bool P2PTransportImpl::AddRemoteCandidate(const std::string& address) { |
| 103 cricket::Candidate candidate; | 112 cricket::Candidate candidate; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void P2PTransportImpl::OnTcpConnected(int result) { | 153 void P2PTransportImpl::OnTcpConnected(int result) { |
| 145 if (result < 0) { | 154 if (result < 0) { |
| 146 event_handler_->OnError(result); | 155 event_handler_->OnError(result); |
| 147 return; | 156 return; |
| 148 } | 157 } |
| 149 state_ = static_cast<State>(STATE_READABLE | STATE_WRITABLE); | 158 state_ = static_cast<State>(STATE_READABLE | STATE_WRITABLE); |
| 150 event_handler_->OnStateChange(state_); | 159 event_handler_->OnStateChange(state_); |
| 151 } | 160 } |
| 152 | 161 |
| 153 } // namespace content | 162 } // namespace content |
| OLD | NEW |