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 identity_(NULL), | 339 identity_(NULL), |
345 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), | 340 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), |
346 ice_tiebreaker_(rtc::CreateRandomId64()), | 341 ice_tiebreaker_(rtc::CreateRandomId64()), |
347 role_switch_(false), | 342 role_switch_(false), |
348 ice_receiving_timeout_(-1) { | 343 ice_receiving_timeout_(-1) { |
349 ASSERT(signaling_thread->IsCurrent()); | 344 ASSERT(signaling_thread->IsCurrent()); |
350 } | 345 } |
351 | 346 |
352 BaseSession::~BaseSession() { | 347 BaseSession::~BaseSession() { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 void BaseSession::DestroyTransportProxy( | 566 void BaseSession::DestroyTransportProxy( |
572 const std::string& content_name) { | 567 const std::string& content_name) { |
573 TransportMap::iterator iter = transports_.find(content_name); | 568 TransportMap::iterator iter = transports_.find(content_name); |
574 if (iter != transports_.end()) { | 569 if (iter != transports_.end()) { |
575 delete iter->second; | 570 delete iter->second; |
576 transports_.erase(content_name); | 571 transports_.erase(content_name); |
577 } | 572 } |
578 } | 573 } |
579 | 574 |
580 Transport* BaseSession::CreateTransport(const std::string& content_name) { | 575 Transport* BaseSession::CreateTransport(const std::string& content_name) { |
581 ASSERT(transport_type_ == NS_GINGLE_P2P); | |
582 Transport* transport = new DtlsTransport<P2PTransport>( | 576 Transport* transport = new DtlsTransport<P2PTransport>( |
583 signaling_thread(), worker_thread(), content_name, port_allocator(), | 577 signaling_thread(), worker_thread(), content_name, port_allocator(), |
584 identity_); | 578 identity_); |
585 transport->SetChannelReceivingTimeout(ice_receiving_timeout_); | 579 transport->SetChannelReceivingTimeout(ice_receiving_timeout_); |
586 return transport; | 580 return transport; |
587 } | 581 } |
588 | 582 |
589 void BaseSession::SetState(State state) { | 583 void BaseSession::SetState(State state) { |
590 ASSERT(signaling_thread_->IsCurrent()); | 584 ASSERT(signaling_thread_->IsCurrent()); |
591 if (state != state_) { | 585 if (state != state_) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // Role will be reverse of initial role setting. | 765 // Role will be reverse of initial role setting. |
772 IceRole role = initiator_ ? ICEROLE_CONTROLLED : ICEROLE_CONTROLLING; | 766 IceRole role = initiator_ ? ICEROLE_CONTROLLED : ICEROLE_CONTROLLING; |
773 iter->second->SetIceRole(role); | 767 iter->second->SetIceRole(role); |
774 } | 768 } |
775 } | 769 } |
776 | 770 |
777 void BaseSession::LogState(State old_state, State new_state) { | 771 void BaseSession::LogState(State old_state, State new_state) { |
778 LOG(LS_INFO) << "Session:" << id() | 772 LOG(LS_INFO) << "Session:" << id() |
779 << " Old state:" << StateToString(old_state) | 773 << " Old state:" << StateToString(old_state) |
780 << " New state:" << StateToString(new_state) | 774 << " New state:" << StateToString(new_state) |
781 << " Type:" << content_type() | 775 << " Type:" << content_type(); |
782 << " Transport:" << transport_type(); | |
783 } | 776 } |
784 | 777 |
785 // static | 778 // static |
786 bool BaseSession::GetTransportDescription(const SessionDescription* description, | 779 bool BaseSession::GetTransportDescription(const SessionDescription* description, |
787 const std::string& content_name, | 780 const std::string& content_name, |
788 TransportDescription* tdesc) { | 781 TransportDescription* tdesc) { |
789 if (!description || !tdesc) { | 782 if (!description || !tdesc) { |
790 return false; | 783 return false; |
791 } | 784 } |
792 const TransportInfo* transport_info = | 785 const TransportInfo* transport_info = |
(...skipping 21 matching lines...) Expand all Loading... |
814 | 807 |
815 default: | 808 default: |
816 // Explicitly ignoring some states here. | 809 // Explicitly ignoring some states here. |
817 break; | 810 break; |
818 } | 811 } |
819 break; | 812 break; |
820 } | 813 } |
821 } | 814 } |
822 | 815 |
823 } // namespace cricket | 816 } // namespace cricket |
OLD | NEW |