| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pepper_session.h" | 5 #include "remoting/protocol/pepper_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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Generate random session ID. There are usually not more than 1 | 72 // Generate random session ID. There are usually not more than 1 |
| 73 // concurrent session per host, so a random 64-bit integer provides | 73 // concurrent session per host, so a random 64-bit integer provides |
| 74 // enough entropy. In the worst case connection will fail when two | 74 // enough entropy. In the worst case connection will fail when two |
| 75 // clients generate the same session ID concurrently. | 75 // clients generate the same session ID concurrently. |
| 76 session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); | 76 session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); |
| 77 | 77 |
| 78 // Send session-initiate message. | 78 // Send session-initiate message. |
| 79 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, | 79 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, |
| 80 session_id_); | 80 session_id_); |
| 81 message.from = session_manager_->local_jid_; | 81 message.from = session_manager_->signal_strategy_->GetLocalJid(); |
| 82 message.description.reset( | 82 message.description.reset( |
| 83 new ContentDescription(candidate_config_->Clone(), | 83 new ContentDescription(candidate_config_->Clone(), |
| 84 authenticator_->GetNextMessage())); | 84 authenticator_->GetNextMessage())); |
| 85 initiate_request_.reset(session_manager_->iq_sender()->SendIq( | 85 initiate_request_.reset(session_manager_->iq_sender()->SendIq( |
| 86 message.ToXml(), | 86 message.ToXml(), |
| 87 base::Bind(&PepperSession::OnSessionInitiateResponse, | 87 base::Bind(&PepperSession::OnSessionInitiateResponse, |
| 88 base::Unretained(this)))); | 88 base::Unretained(this)))); |
| 89 | 89 |
| 90 SetState(CONNECTING); | 90 SetState(CONNECTING); |
| 91 } | 91 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 DCHECK_NE(state_, FAILED); | 425 DCHECK_NE(state_, FAILED); |
| 426 | 426 |
| 427 state_ = new_state; | 427 state_ = new_state; |
| 428 if (!state_change_callback_.is_null()) | 428 if (!state_change_callback_.is_null()) |
| 429 state_change_callback_.Run(new_state); | 429 state_change_callback_.Run(new_state); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 | 432 |
| 433 } // namespace protocol | 433 } // namespace protocol |
| 434 } // namespace remoting | 434 } // namespace remoting |
| OLD | NEW |