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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 DCHECK(authenticator.get()); | 107 DCHECK(authenticator.get()); |
108 DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY); | 108 DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY); |
109 | 109 |
110 peer_jid_ = peer_jid; | 110 peer_jid_ = peer_jid; |
111 authenticator_ = authenticator.Pass(); | 111 authenticator_ = authenticator.Pass(); |
112 | 112 |
113 // Generate random session ID. There are usually not more than 1 | 113 // Generate random session ID. There are usually not more than 1 |
114 // concurrent session per host, so a random 64-bit integer provides | 114 // concurrent session per host, so a random 64-bit integer provides |
115 // enough entropy. In the worst case connection will fail when two | 115 // enough entropy. In the worst case connection will fail when two |
116 // clients generate the same session ID concurrently. | 116 // clients generate the same session ID concurrently. |
117 session_id_ = base::Int64ToString(base::RandGenerator(kint64max)); | 117 session_id_ = base::Uint64ToString(base::RandGenerator(kuint64max)); |
118 | 118 |
119 quic_channel_factory_.reset(new QuicChannelFactory(session_id_, false)); | 119 quic_channel_factory_.reset(new QuicChannelFactory(session_id_, false)); |
120 | 120 |
121 // Send session-initiate message. | 121 // Send session-initiate message. |
122 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, | 122 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, |
123 session_id_); | 123 session_id_); |
124 message.initiator = session_manager_->signal_strategy_->GetLocalJid(); | 124 message.initiator = session_manager_->signal_strategy_->GetLocalJid(); |
125 message.description.reset(new ContentDescription( | 125 message.description.reset(new ContentDescription( |
126 session_manager_->protocol_config_->Clone(), | 126 session_manager_->protocol_config_->Clone(), |
127 authenticator_->GetNextMessage(), | 127 authenticator_->GetNextMessage(), |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 737 } |
738 } | 738 } |
739 | 739 |
740 bool JingleSession::is_session_active() { | 740 bool JingleSession::is_session_active() { |
741 return state_ == CONNECTING || state_ == ACCEPTING || state_ == CONNECTED || | 741 return state_ == CONNECTING || state_ == ACCEPTING || state_ == CONNECTED || |
742 state_ == AUTHENTICATING || state_ == AUTHENTICATED; | 742 state_ == AUTHENTICATING || state_ == AUTHENTICATED; |
743 } | 743 } |
744 | 744 |
745 } // namespace protocol | 745 } // namespace protocol |
746 } // namespace remoting | 746 } // namespace remoting |
OLD | NEW |