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