Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: remoting/protocol/jingle_session.cc

Issue 1359453003: Use the appropriate variant of IntToString in //remoting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the full range of uint64 in RandGenerator. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/jingle_messages.cc ('k') | remoting/protocol/message_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_messages.cc ('k') | remoting/protocol/message_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698