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

Side by Side Diff: webrtc/p2p/base/session.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/session.h ('k') | webrtc/p2p/base/session_unittest.cc » ('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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 signaling_thread_(signaling_thread), 337 signaling_thread_(signaling_thread),
338 worker_thread_(worker_thread), 338 worker_thread_(worker_thread),
339 port_allocator_(port_allocator), 339 port_allocator_(port_allocator),
340 sid_(sid), 340 sid_(sid),
341 content_type_(content_type), 341 content_type_(content_type),
342 transport_type_(NS_GINGLE_P2P), 342 transport_type_(NS_GINGLE_P2P),
343 initiator_(initiator), 343 initiator_(initiator),
344 identity_(NULL), 344 identity_(NULL),
345 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), 345 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10),
346 ice_tiebreaker_(rtc::CreateRandomId64()), 346 ice_tiebreaker_(rtc::CreateRandomId64()),
347 role_switch_(false) { 347 role_switch_(false),
348 ice_receiving_timeout_(-1) {
348 ASSERT(signaling_thread->IsCurrent()); 349 ASSERT(signaling_thread->IsCurrent());
349 } 350 }
350 351
351 BaseSession::~BaseSession() { 352 BaseSession::~BaseSession() {
352 ASSERT(signaling_thread()->IsCurrent()); 353 ASSERT(signaling_thread()->IsCurrent());
353 354
354 ASSERT(state_ != STATE_DEINIT); 355 ASSERT(state_ != STATE_DEINIT);
355 LogState(state_, STATE_DEINIT); 356 LogState(state_, STATE_DEINIT);
356 state_ = STATE_DEINIT; 357 state_ = STATE_DEINIT;
357 SignalState(this, state_); 358 SignalState(this, state_);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (!iter->second->SetRemoteTransportDescription(tdesc, action, 471 if (!iter->second->SetRemoteTransportDescription(tdesc, action,
471 error_desc)) { 472 error_desc)) {
472 return false; 473 return false;
473 } 474 }
474 } 475 }
475 } 476 }
476 477
477 return true; 478 return true;
478 } 479 }
479 480
481 void BaseSession::SetIceConnectionReceivingTimeout(int timeout_ms) {
482 ice_receiving_timeout_ = timeout_ms;
483 for (const auto& kv : transport_proxies()) {
484 Transport* transport = kv.second->impl();
485 if (transport) {
486 transport->SetChannelReceivingTimeout(timeout_ms);
487 }
488 }
489 }
490
480 TransportChannel* BaseSession::CreateChannel(const std::string& content_name, 491 TransportChannel* BaseSession::CreateChannel(const std::string& content_name,
481 int component) { 492 int component) {
482 // We create the proxy "on demand" here because we need to support 493 // We create the proxy "on demand" here because we need to support
483 // creating channels at any time, even before we send or receive 494 // creating channels at any time, even before we send or receive
484 // initiate messages, which is before we create the transports. 495 // initiate messages, which is before we create the transports.
485 TransportProxy* transproxy = GetOrCreateTransportProxy(content_name); 496 TransportProxy* transproxy = GetOrCreateTransportProxy(content_name);
486 return transproxy->CreateChannel(component); 497 return transproxy->CreateChannel(component);
487 } 498 }
488 499
489 TransportChannel* BaseSession::GetChannel(const std::string& content_name, 500 TransportChannel* BaseSession::GetChannel(const std::string& content_name,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 570
560 void BaseSession::DestroyTransportProxy( 571 void BaseSession::DestroyTransportProxy(
561 const std::string& content_name) { 572 const std::string& content_name) {
562 TransportMap::iterator iter = transports_.find(content_name); 573 TransportMap::iterator iter = transports_.find(content_name);
563 if (iter != transports_.end()) { 574 if (iter != transports_.end()) {
564 delete iter->second; 575 delete iter->second;
565 transports_.erase(content_name); 576 transports_.erase(content_name);
566 } 577 }
567 } 578 }
568 579
569 cricket::Transport* BaseSession::CreateTransport( 580 Transport* BaseSession::CreateTransport(const std::string& content_name) {
570 const std::string& content_name) {
571 ASSERT(transport_type_ == NS_GINGLE_P2P); 581 ASSERT(transport_type_ == NS_GINGLE_P2P);
572 return new cricket::DtlsTransport<P2PTransport>( 582 Transport* transport = new DtlsTransport<P2PTransport>(
573 signaling_thread(), worker_thread(), content_name, 583 signaling_thread(), worker_thread(), content_name, port_allocator(),
574 port_allocator(), identity_); 584 identity_);
585 transport->SetChannelReceivingTimeout(ice_receiving_timeout_);
586 return transport;
575 } 587 }
576 588
577 void BaseSession::SetState(State state) { 589 void BaseSession::SetState(State state) {
578 ASSERT(signaling_thread_->IsCurrent()); 590 ASSERT(signaling_thread_->IsCurrent());
579 if (state != state_) { 591 if (state != state_) {
580 LogState(state_, state); 592 LogState(state_, state);
581 state_ = state; 593 state_ = state;
582 SignalState(this, state_); 594 SignalState(this, state_);
583 signaling_thread_->Post(this, MSG_STATE); 595 signaling_thread_->Post(this, MSG_STATE);
584 } 596 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 863
852 default: 864 default:
853 // Explicitly ignoring some states here. 865 // Explicitly ignoring some states here.
854 break; 866 break;
855 } 867 }
856 break; 868 break;
857 } 869 }
858 } 870 }
859 871
860 } // namespace cricket 872 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/session.h ('k') | webrtc/p2p/base/session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698