| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 using rtc::Bind; | 30 using rtc::Bind; |
| 31 | 31 |
| 32 TransportProxy::~TransportProxy() { | 32 TransportProxy::~TransportProxy() { |
| 33 for (ChannelMap::iterator iter = channels_.begin(); | 33 for (ChannelMap::iterator iter = channels_.begin(); |
| 34 iter != channels_.end(); ++iter) { | 34 iter != channels_.end(); ++iter) { |
| 35 iter->second->SignalDestroyed(iter->second); | 35 iter->second->SignalDestroyed(iter->second); |
| 36 delete iter->second; | 36 delete iter->second; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 const std::string& TransportProxy::type() const { | |
| 41 return transport_->get()->type(); | |
| 42 } | |
| 43 | |
| 44 TransportChannel* TransportProxy::GetChannel(int component) { | 40 TransportChannel* TransportProxy::GetChannel(int component) { |
| 45 ASSERT(rtc::Thread::Current() == worker_thread_); | 41 ASSERT(rtc::Thread::Current() == worker_thread_); |
| 46 return GetChannelProxy(component); | 42 return GetChannelProxy(component); |
| 47 } | 43 } |
| 48 | 44 |
| 49 TransportChannel* TransportProxy::CreateChannel(int component) { | 45 TransportChannel* TransportProxy::CreateChannel(int component) { |
| 50 ASSERT(rtc::Thread::Current() == worker_thread_); | 46 ASSERT(rtc::Thread::Current() == worker_thread_); |
| 51 ASSERT(GetChannel(component) == NULL); | 47 ASSERT(GetChannel(component) == NULL); |
| 52 ASSERT(!transport_->get()->HasChannel(component)); | 48 ASSERT(!transport_->get()->HasChannel(component)); |
| 53 | 49 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 const std::string& sid, | 328 const std::string& sid, |
| 333 const std::string& content_type, | 329 const std::string& content_type, |
| 334 bool initiator) | 330 bool initiator) |
| 335 : state_(STATE_INIT), | 331 : state_(STATE_INIT), |
| 336 error_(ERROR_NONE), | 332 error_(ERROR_NONE), |
| 337 signaling_thread_(signaling_thread), | 333 signaling_thread_(signaling_thread), |
| 338 worker_thread_(worker_thread), | 334 worker_thread_(worker_thread), |
| 339 port_allocator_(port_allocator), | 335 port_allocator_(port_allocator), |
| 340 sid_(sid), | 336 sid_(sid), |
| 341 content_type_(content_type), | 337 content_type_(content_type), |
| 342 transport_type_(NS_GINGLE_P2P), | |
| 343 initiator_(initiator), | 338 initiator_(initiator), |
| 344 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), | 339 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), |
| 345 ice_tiebreaker_(rtc::CreateRandomId64()), | 340 ice_tiebreaker_(rtc::CreateRandomId64()), |
| 346 role_switch_(false), | 341 role_switch_(false), |
| 347 ice_receiving_timeout_(-1) { | 342 ice_receiving_timeout_(-1) { |
| 348 ASSERT(signaling_thread->IsCurrent()); | 343 ASSERT(signaling_thread->IsCurrent()); |
| 349 } | 344 } |
| 350 | 345 |
| 351 BaseSession::~BaseSession() { | 346 BaseSession::~BaseSession() { |
| 352 ASSERT(signaling_thread()->IsCurrent()); | 347 ASSERT(signaling_thread()->IsCurrent()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 void BaseSession::DestroyTransportProxy( | 568 void BaseSession::DestroyTransportProxy( |
| 574 const std::string& content_name) { | 569 const std::string& content_name) { |
| 575 TransportMap::iterator iter = transports_.find(content_name); | 570 TransportMap::iterator iter = transports_.find(content_name); |
| 576 if (iter != transports_.end()) { | 571 if (iter != transports_.end()) { |
| 577 delete iter->second; | 572 delete iter->second; |
| 578 transports_.erase(content_name); | 573 transports_.erase(content_name); |
| 579 } | 574 } |
| 580 } | 575 } |
| 581 | 576 |
| 582 Transport* BaseSession::CreateTransport(const std::string& content_name) { | 577 Transport* BaseSession::CreateTransport(const std::string& content_name) { |
| 583 ASSERT(transport_type_ == NS_GINGLE_P2P); | |
| 584 Transport* transport = new DtlsTransport<P2PTransport>( | 578 Transport* transport = new DtlsTransport<P2PTransport>( |
| 585 signaling_thread(), worker_thread(), content_name, port_allocator(), | 579 signaling_thread(), worker_thread(), content_name, port_allocator(), |
| 586 certificate_); | 580 certificate_); |
| 587 transport->SetChannelReceivingTimeout(ice_receiving_timeout_); | 581 transport->SetChannelReceivingTimeout(ice_receiving_timeout_); |
| 588 return transport; | 582 return transport; |
| 589 } | 583 } |
| 590 | 584 |
| 591 void BaseSession::SetState(State state) { | 585 void BaseSession::SetState(State state) { |
| 592 ASSERT(signaling_thread_->IsCurrent()); | 586 ASSERT(signaling_thread_->IsCurrent()); |
| 593 if (state != state_) { | 587 if (state != state_) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // Role will be reverse of initial role setting. | 767 // Role will be reverse of initial role setting. |
| 774 IceRole role = initiator_ ? ICEROLE_CONTROLLED : ICEROLE_CONTROLLING; | 768 IceRole role = initiator_ ? ICEROLE_CONTROLLED : ICEROLE_CONTROLLING; |
| 775 iter->second->SetIceRole(role); | 769 iter->second->SetIceRole(role); |
| 776 } | 770 } |
| 777 } | 771 } |
| 778 | 772 |
| 779 void BaseSession::LogState(State old_state, State new_state) { | 773 void BaseSession::LogState(State old_state, State new_state) { |
| 780 LOG(LS_INFO) << "Session:" << id() | 774 LOG(LS_INFO) << "Session:" << id() |
| 781 << " Old state:" << StateToString(old_state) | 775 << " Old state:" << StateToString(old_state) |
| 782 << " New state:" << StateToString(new_state) | 776 << " New state:" << StateToString(new_state) |
| 783 << " Type:" << content_type() | 777 << " Type:" << content_type(); |
| 784 << " Transport:" << transport_type(); | |
| 785 } | 778 } |
| 786 | 779 |
| 787 // static | 780 // static |
| 788 bool BaseSession::GetTransportDescription(const SessionDescription* description, | 781 bool BaseSession::GetTransportDescription(const SessionDescription* description, |
| 789 const std::string& content_name, | 782 const std::string& content_name, |
| 790 TransportDescription* tdesc) { | 783 TransportDescription* tdesc) { |
| 791 if (!description || !tdesc) { | 784 if (!description || !tdesc) { |
| 792 return false; | 785 return false; |
| 793 } | 786 } |
| 794 const TransportInfo* transport_info = | 787 const TransportInfo* transport_info = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 816 | 809 |
| 817 default: | 810 default: |
| 818 // Explicitly ignoring some states here. | 811 // Explicitly ignoring some states here. |
| 819 break; | 812 break; |
| 820 } | 813 } |
| 821 break; | 814 break; |
| 822 } | 815 } |
| 823 } | 816 } |
| 824 | 817 |
| 825 } // namespace cricket | 818 } // namespace cricket |
| OLD | NEW |