Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/jingle_session_manager.h" | 5 #include "remoting/protocol/jingle_session_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "remoting/jingle_glue/iq_sender.h" | 8 #include "remoting/jingle_glue/iq_sender.h" |
| 9 #include "remoting/jingle_glue/jingle_info_request.h" | 9 #include "remoting/jingle_glue/jingle_info_request.h" |
| 10 #include "remoting/jingle_glue/signal_strategy.h" | 10 #include "remoting/jingle_glue/signal_strategy.h" |
| 11 #include "remoting/protocol/authenticator.h" | 11 #include "remoting/protocol/authenticator.h" |
| 12 #include "remoting/protocol/content_description.h" | 12 #include "remoting/protocol/content_description.h" |
| 13 #include "remoting/protocol/jingle_messages.h" | 13 #include "remoting/protocol/jingle_messages.h" |
| 14 #include "remoting/protocol/jingle_session.h" | 14 #include "remoting/protocol/jingle_session.h" |
| 15 #include "remoting/protocol/transport.h" | |
| 16 #include "remoting/protocol/transport_config.h" | |
| 15 #include "third_party/libjingle/source/talk/base/socketaddress.h" | 17 #include "third_party/libjingle/source/talk/base/socketaddress.h" |
| 16 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 18 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| 17 | 19 |
| 18 using buzz::QName; | 20 using buzz::QName; |
| 19 | 21 |
| 20 namespace remoting { | 22 namespace remoting { |
| 21 namespace protocol { | 23 namespace protocol { |
| 22 | 24 |
| 23 JingleSessionManager::JingleSessionManager( | 25 JingleSessionManager::JingleSessionManager( |
| 24 scoped_ptr<TransportFactory> transport_factory, | 26 scoped_ptr<TransportFactory> transport_factory, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 45 | 47 |
| 46 OnSignalStrategyStateChange(signal_strategy_->GetState()); | 48 OnSignalStrategyStateChange(signal_strategy_->GetState()); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void JingleSessionManager::OnJingleInfo( | 51 void JingleSessionManager::OnJingleInfo( |
| 50 const std::string& relay_token, | 52 const std::string& relay_token, |
| 51 const std::vector<std::string>& relay_hosts, | 53 const std::vector<std::string>& relay_hosts, |
| 52 const std::vector<talk_base::SocketAddress>& stun_hosts) { | 54 const std::vector<talk_base::SocketAddress>& stun_hosts) { |
| 53 DCHECK(CalledOnValidThread()); | 55 DCHECK(CalledOnValidThread()); |
| 54 | 56 |
| 57 TransportConfig config; | |
|
Wez
2012/04/27 23:49:15
nit: Move this below the comment, to immediately p
Sergey Ulanov
2012/04/28 00:18:19
Done.
| |
| 58 | |
| 55 // TODO(sergeyu): Add support for multiple STUN/relay servers when | 59 // TODO(sergeyu): Add support for multiple STUN/relay servers when |
| 56 // it's implemented in libjingle and P2P Transport API. | 60 // it's implemented in libjingle and P2P Transport API. |
| 57 transport_config_.stun_server = stun_hosts[0].ToString(); | 61 config.stun_server = stun_hosts[0].ToString(); |
| 58 transport_config_.relay_server = relay_hosts[0]; | 62 config.relay_server = relay_hosts[0]; |
| 59 transport_config_.relay_token = relay_token; | 63 config.relay_token = relay_token; |
| 60 VLOG(1) << "STUN server: " << transport_config_.stun_server | 64 VLOG(1) << "STUN server: " << config.stun_server |
| 61 << " Relay server: " << transport_config_.relay_server | 65 << " Relay server: " << config.relay_server |
| 62 << " Relay token: " << transport_config_.relay_token; | 66 << " Relay token: " << config.relay_token; |
| 67 | |
| 68 transport_factory_->SetConfig(config); | |
|
Wez
2012/04/27 23:49:15
nit: Move this to immediately follow the setters,
Sergey Ulanov
2012/04/28 00:18:19
Done.
| |
| 63 | 69 |
| 64 if (!ready_) { | 70 if (!ready_) { |
| 65 ready_ = true; | 71 ready_ = true; |
| 66 listener_->OnSessionManagerReady(); | 72 listener_->OnSessionManagerReady(); |
| 67 } | 73 } |
| 68 } | 74 } |
| 69 | 75 |
| 70 scoped_ptr<Session> JingleSessionManager::Connect( | 76 scoped_ptr<Session> JingleSessionManager::Connect( |
| 71 const std::string& host_jid, | 77 const std::string& host_jid, |
| 72 scoped_ptr<Authenticator> authenticator, | 78 scoped_ptr<Authenticator> authenticator, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 signal_strategy_->SendStanza( | 196 signal_strategy_->SendStanza( |
| 191 JingleMessageReply(error).ToXml(original_stanza)); | 197 JingleMessageReply(error).ToXml(original_stanza)); |
| 192 } | 198 } |
| 193 | 199 |
| 194 void JingleSessionManager::SessionDestroyed(JingleSession* session) { | 200 void JingleSessionManager::SessionDestroyed(JingleSession* session) { |
| 195 sessions_.erase(session->session_id_); | 201 sessions_.erase(session->session_id_); |
| 196 } | 202 } |
| 197 | 203 |
| 198 } // namespace protocol | 204 } // namespace protocol |
| 199 } // namespace remoting | 205 } // namespace remoting |
| OLD | NEW |