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

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

Issue 1502503004: Remove kuint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint8
Patch Set: rebase Created 5 years 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
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 <stdint.h>
8
9 #include <limits>
10
7 #include "base/bind.h" 11 #include "base/bind.h"
8 #include "base/rand_util.h" 12 #include "base/rand_util.h"
9 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 14 #include "base/stl_util.h"
11 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
12 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 17 #include "base/time/time.h"
14 #include "remoting/base/constants.h" 18 #include "remoting/base/constants.h"
15 #include "remoting/protocol/authenticator.h" 19 #include "remoting/protocol/authenticator.h"
16 #include "remoting/protocol/content_description.h" 20 #include "remoting/protocol/content_description.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DCHECK(authenticator.get()); 95 DCHECK(authenticator.get());
92 DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY); 96 DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY);
93 97
94 peer_jid_ = peer_jid; 98 peer_jid_ = peer_jid;
95 authenticator_ = authenticator.Pass(); 99 authenticator_ = authenticator.Pass();
96 100
97 // Generate random session ID. There are usually not more than 1 101 // Generate random session ID. There are usually not more than 1
98 // concurrent session per host, so a random 64-bit integer provides 102 // concurrent session per host, so a random 64-bit integer provides
99 // enough entropy. In the worst case connection will fail when two 103 // enough entropy. In the worst case connection will fail when two
100 // clients generate the same session ID concurrently. 104 // clients generate the same session ID concurrently.
101 session_id_ = base::Uint64ToString(base::RandGenerator(kuint64max)); 105 session_id_ = base::Uint64ToString(
106 base::RandGenerator(std::numeric_limits<uint64_t>::max()));
102 107
103 transport_ = session_manager_->transport_factory_->CreateTransport(); 108 transport_ = session_manager_->transport_factory_->CreateTransport();
104 109
105 // Send session-initiate message. 110 // Send session-initiate message.
106 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE, 111 JingleMessage message(peer_jid_, JingleMessage::SESSION_INITIATE,
107 session_id_); 112 session_id_);
108 message.initiator = session_manager_->signal_strategy_->GetLocalJid(); 113 message.initiator = session_manager_->signal_strategy_->GetLocalJid();
109 message.description.reset(new ContentDescription( 114 message.description.reset(new ContentDescription(
110 session_manager_->protocol_config_->Clone(), 115 session_manager_->protocol_config_->Clone(),
111 authenticator_->GetNextMessage())); 116 authenticator_->GetNextMessage()));
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 601 }
597 } 602 }
598 603
599 bool JingleSession::is_session_active() { 604 bool JingleSession::is_session_active() {
600 return state_ == CONNECTING || state_ == ACCEPTING || state_ == ACCEPTED || 605 return state_ == CONNECTING || state_ == ACCEPTING || state_ == ACCEPTED ||
601 state_ == AUTHENTICATING || state_ == AUTHENTICATED; 606 state_ == AUTHENTICATING || state_ == AUTHENTICATED;
602 } 607 }
603 608
604 } // namespace protocol 609 } // namespace protocol
605 } // namespace remoting 610 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698