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