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 22 matching lines...) Expand all Loading... |
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 |
55 // TODO(sergeyu): Add support for multiple STUN/relay servers when | 57 // TODO(sergeyu): Add support for multiple STUN/relay servers when |
56 // it's implemented in libjingle and P2P Transport API. | 58 // it's implemented in libjingle and P2P Transport API. |
57 transport_config_.stun_server = stun_hosts[0].ToString(); | 59 TransportConfig config; |
58 transport_config_.relay_server = relay_hosts[0]; | 60 config.stun_server = stun_hosts[0].ToString(); |
59 transport_config_.relay_token = relay_token; | 61 config.relay_server = relay_hosts[0]; |
60 VLOG(1) << "STUN server: " << transport_config_.stun_server | 62 config.relay_token = relay_token; |
61 << " Relay server: " << transport_config_.relay_server | 63 transport_factory_->SetTransportConfig(config); |
62 << " Relay token: " << transport_config_.relay_token; | 64 |
| 65 VLOG(1) << "STUN server: " << config.stun_server |
| 66 << " Relay server: " << config.relay_server |
| 67 << " Relay token: " << config.relay_token; |
| 68 |
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 |