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.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Generate random session ID. There are usually not more than 1 | 102 // Generate random session ID. There are usually not more than 1 |
103 // concurrent session per host, so a random 64-bit integer provides | 103 // concurrent session per host, so a random 64-bit integer provides |
104 // enough entropy. In the worst case connection will fail when two | 104 // enough entropy. In the worst case connection will fail when two |
105 // clients generate the same session ID concurrently. | 105 // clients generate the same session ID concurrently. |
106 session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); | 106 session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); |
107 | 107 |
108 // Send session-initiate message. | 108 // Send session-initiate message. |
109 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, | 109 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, |
110 session_id_); | 110 session_id_); |
111 message.from = session_manager_->signal_strategy_->GetLocalJid(); | 111 message.initiator = session_manager_->signal_strategy_->GetLocalJid(); |
112 message.description.reset( | 112 message.description.reset( |
113 new ContentDescription(candidate_config_->Clone(), | 113 new ContentDescription(candidate_config_->Clone(), |
114 authenticator_->GetNextMessage())); | 114 authenticator_->GetNextMessage())); |
115 SendMessage(message); | 115 SendMessage(message); |
116 | 116 |
117 SetState(CONNECTING); | 117 SetState(CONNECTING); |
118 } | 118 } |
119 | 119 |
120 void JingleSession::InitializeIncomingConnection( | 120 void JingleSession::InitializeIncomingConnection( |
121 const JingleMessage& initiate_message, | 121 const JingleMessage& initiate_message, |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 DCHECK_NE(state_, FAILED); | 628 DCHECK_NE(state_, FAILED); |
629 | 629 |
630 state_ = new_state; | 630 state_ = new_state; |
631 if (event_handler_) | 631 if (event_handler_) |
632 event_handler_->OnSessionStateChange(new_state); | 632 event_handler_->OnSessionStateChange(new_state); |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 } // namespace protocol | 636 } // namespace protocol |
637 } // namespace remoting | 637 } // namespace remoting |
OLD | NEW |