Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: webrtc/p2p/base/transport.cc

Issue 1231913003: Add methods to set the ICE connection receiving_timeout values. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/transport.h ('k') | webrtc/p2p/base/transportchannelimpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 const TransportDescription& new_desc) { 114 const TransportDescription& new_desc) {
115 return IceCredentialsChanged(old_desc.ice_ufrag, old_desc.ice_pwd, 115 return IceCredentialsChanged(old_desc.ice_ufrag, old_desc.ice_pwd,
116 new_desc.ice_ufrag, new_desc.ice_pwd); 116 new_desc.ice_ufrag, new_desc.ice_pwd);
117 } 117 }
118 118
119 Transport::Transport(rtc::Thread* signaling_thread, 119 Transport::Transport(rtc::Thread* signaling_thread,
120 rtc::Thread* worker_thread, 120 rtc::Thread* worker_thread,
121 const std::string& content_name, 121 const std::string& content_name,
122 const std::string& type, 122 const std::string& type,
123 PortAllocator* allocator) 123 PortAllocator* allocator)
124 : signaling_thread_(signaling_thread), 124 : signaling_thread_(signaling_thread),
125 worker_thread_(worker_thread), 125 worker_thread_(worker_thread),
126 content_name_(content_name), 126 content_name_(content_name),
127 type_(type), 127 type_(type),
128 allocator_(allocator), 128 allocator_(allocator),
129 destroyed_(false), 129 destroyed_(false),
130 readable_(TRANSPORT_STATE_NONE), 130 readable_(TRANSPORT_STATE_NONE),
131 writable_(TRANSPORT_STATE_NONE), 131 writable_(TRANSPORT_STATE_NONE),
132 receiving_(TRANSPORT_STATE_NONE), 132 receiving_(TRANSPORT_STATE_NONE),
133 was_writable_(false), 133 was_writable_(false),
134 connect_requested_(false), 134 connect_requested_(false),
135 ice_role_(ICEROLE_UNKNOWN), 135 ice_role_(ICEROLE_UNKNOWN),
136 tiebreaker_(0), 136 tiebreaker_(0),
137 protocol_(ICEPROTO_HYBRID), 137 protocol_(ICEPROTO_HYBRID),
138 remote_ice_mode_(ICEMODE_FULL) { 138 remote_ice_mode_(ICEMODE_FULL),
139 channel_receiving_timeout_(-1) {
139 } 140 }
140 141
141 Transport::~Transport() { 142 Transport::~Transport() {
142 ASSERT(signaling_thread_->IsCurrent()); 143 ASSERT(signaling_thread_->IsCurrent());
143 ASSERT(destroyed_); 144 ASSERT(destroyed_);
144 } 145 }
145 146
146 void Transport::SetIceRole(IceRole role) { 147 void Transport::SetIceRole(IceRole role) {
147 worker_thread_->Invoke<void>(Bind(&Transport::SetIceRole_w, this, role)); 148 worker_thread_->Invoke<void>(Bind(&Transport::SetIceRole_w, this, role));
148 } 149 }
(...skipping 18 matching lines...) Expand all
167 168
168 bool Transport::GetRemoteCertificate_w(rtc::SSLCertificate** cert) { 169 bool Transport::GetRemoteCertificate_w(rtc::SSLCertificate** cert) {
169 ASSERT(worker_thread()->IsCurrent()); 170 ASSERT(worker_thread()->IsCurrent());
170 if (channels_.empty()) 171 if (channels_.empty())
171 return false; 172 return false;
172 173
173 ChannelMap::iterator iter = channels_.begin(); 174 ChannelMap::iterator iter = channels_.begin();
174 return iter->second->GetRemoteCertificate(cert); 175 return iter->second->GetRemoteCertificate(cert);
175 } 176 }
176 177
178 void Transport::SetChannelReceivingTimeout(int timeout_ms) {
179 worker_thread_->Invoke<void>(
180 Bind(&Transport::SetChannelReceivingTimeout_w, this, timeout_ms));
181 }
182
183 void Transport::SetChannelReceivingTimeout_w(int timeout_ms) {
184 ASSERT(worker_thread()->IsCurrent());
185 channel_receiving_timeout_ = timeout_ms;
186 for (const auto& kv : channels_) {
187 kv.second->SetReceivingTimeout(timeout_ms);
188 }
189 }
190
177 bool Transport::SetLocalTransportDescription( 191 bool Transport::SetLocalTransportDescription(
178 const TransportDescription& description, 192 const TransportDescription& description,
179 ContentAction action, 193 ContentAction action,
180 std::string* error_desc) { 194 std::string* error_desc) {
181 return worker_thread_->Invoke<bool>(Bind( 195 return worker_thread_->Invoke<bool>(Bind(
182 &Transport::SetLocalTransportDescription_w, this, 196 &Transport::SetLocalTransportDescription_w, this,
183 description, action, error_desc)); 197 description, action, error_desc));
184 } 198 }
185 199
186 bool Transport::SetRemoteTransportDescription( 200 bool Transport::SetRemoteTransportDescription(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 240
227 if (impl_exists) { 241 if (impl_exists) {
228 // If this is an existing channel, we should just return it without 242 // If this is an existing channel, we should just return it without
229 // connecting to all the signal again. 243 // connecting to all the signal again.
230 return impl; 244 return impl;
231 } 245 }
232 246
233 // Push down our transport state to the new channel. 247 // Push down our transport state to the new channel.
234 impl->SetIceRole(ice_role_); 248 impl->SetIceRole(ice_role_);
235 impl->SetIceTiebreaker(tiebreaker_); 249 impl->SetIceTiebreaker(tiebreaker_);
250 impl->SetReceivingTimeout(channel_receiving_timeout_);
236 // TODO(ronghuawu): Change CreateChannel_w to be able to return error since 251 // TODO(ronghuawu): Change CreateChannel_w to be able to return error since
237 // below Apply**Description_w calls can fail. 252 // below Apply**Description_w calls can fail.
238 if (local_description_) 253 if (local_description_)
239 ApplyLocalTransportDescription_w(impl, NULL); 254 ApplyLocalTransportDescription_w(impl, NULL);
240 if (remote_description_) 255 if (remote_description_)
241 ApplyRemoteTransportDescription_w(impl, NULL); 256 ApplyRemoteTransportDescription_w(impl, NULL);
242 if (local_description_ && remote_description_) 257 if (local_description_ && remote_description_)
243 ApplyNegotiatedTransportDescription_w(impl, NULL); 258 ApplyNegotiatedTransportDescription_w(impl, NULL);
244 259
245 impl->SignalReadableState.connect(this, &Transport::OnChannelReadableState); 260 impl->SignalReadableState.connect(this, &Transport::OnChannelReadableState);
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 const TransportDescription* desc) { 980 const TransportDescription* desc) {
966 ASSERT(desc != NULL); 981 ASSERT(desc != NULL);
967 if (desc->transport_type == NS_JINGLE_ICE_UDP) { 982 if (desc->transport_type == NS_JINGLE_ICE_UDP) {
968 return (desc->HasOption(ICE_OPTION_GICE)) ? 983 return (desc->HasOption(ICE_OPTION_GICE)) ?
969 ICEPROTO_HYBRID : ICEPROTO_RFC5245; 984 ICEPROTO_HYBRID : ICEPROTO_RFC5245;
970 } 985 }
971 return ICEPROTO_GOOGLE; 986 return ICEPROTO_GOOGLE;
972 } 987 }
973 988
974 } // namespace cricket 989 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transport.h ('k') | webrtc/p2p/base/transportchannelimpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698