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

Side by Side Diff: net/quic/core/quic_server_session_base.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 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 | « net/quic/core/quic_server_id.cc ('k') | net/quic/core/quic_session.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 "net/quic/core/quic_server_session_base.h" 5 #include "net/quic/core/quic_server_session_base.h"
6 6
7 #include "base/logging.h"
8 #include "net/quic/core/proto/cached_network_parameters.pb.h" 7 #include "net/quic/core/proto/cached_network_parameters.pb.h"
9 #include "net/quic/core/quic_connection.h" 8 #include "net/quic/core/quic_connection.h"
10 #include "net/quic/core/quic_flags.h" 9 #include "net/quic/core/quic_flags.h"
11 #include "net/quic/core/quic_spdy_session.h" 10 #include "net/quic/core/quic_spdy_session.h"
12 #include "net/quic/core/quic_stream.h" 11 #include "net/quic/core/quic_stream.h"
13 #include "net/quic/platform/api/quic_bug_tracker.h" 12 #include "net/quic/platform/api/quic_bug_tracker.h"
13 #include "net/quic/platform/api/quic_logging.h"
14 14
15 using std::string; 15 using std::string;
16 16
17 namespace net { 17 namespace net {
18 18
19 QuicServerSessionBase::QuicServerSessionBase( 19 QuicServerSessionBase::QuicServerSessionBase(
20 const QuicConfig& config, 20 const QuicConfig& config,
21 QuicConnection* connection, 21 QuicConnection* connection,
22 Visitor* visitor, 22 Visitor* visitor,
23 QuicCryptoServerStream::Helper* helper, 23 QuicCryptoServerStream::Helper* helper,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Define "substantial" difference as a 50% increase or decrease from the 141 // Define "substantial" difference as a 50% increase or decrease from the
142 // last estimate. 142 // last estimate.
143 bool substantial_difference = 143 bool substantial_difference =
144 bandwidth_delta > 144 bandwidth_delta >
145 0.5 * bandwidth_estimate_sent_to_client_.ToBitsPerSecond(); 145 0.5 * bandwidth_estimate_sent_to_client_.ToBitsPerSecond();
146 if (!substantial_difference) { 146 if (!substantial_difference) {
147 return; 147 return;
148 } 148 }
149 149
150 bandwidth_estimate_sent_to_client_ = new_bandwidth_estimate; 150 bandwidth_estimate_sent_to_client_ = new_bandwidth_estimate;
151 DVLOG(1) << "Server: sending new bandwidth estimate (KBytes/s): " 151 QUIC_DVLOG(1) << "Server: sending new bandwidth estimate (KBytes/s): "
152 << bandwidth_estimate_sent_to_client_.ToKBytesPerSecond(); 152 << bandwidth_estimate_sent_to_client_.ToKBytesPerSecond();
153 153
154 // Include max bandwidth in the update. 154 // Include max bandwidth in the update.
155 QuicBandwidth max_bandwidth_estimate = 155 QuicBandwidth max_bandwidth_estimate =
156 bandwidth_recorder->MaxBandwidthEstimate(); 156 bandwidth_recorder->MaxBandwidthEstimate();
157 int32_t max_bandwidth_timestamp = bandwidth_recorder->MaxBandwidthTimestamp(); 157 int32_t max_bandwidth_timestamp = bandwidth_recorder->MaxBandwidthTimestamp();
158 158
159 // Fill the proto before passing it to the crypto stream to send. 159 // Fill the proto before passing it to the crypto stream to send.
160 const int32_t bw_estimate_bytes_per_second = 160 const int32_t bw_estimate_bytes_per_second =
161 BandwidthToCachedParameterBytesPerSecond( 161 BandwidthToCachedParameterBytesPerSecond(
162 bandwidth_estimate_sent_to_client_); 162 bandwidth_estimate_sent_to_client_);
(...skipping 30 matching lines...) Expand all
193 last_scup_packet_number_ = connection()->packet_number_of_last_sent_packet(); 193 last_scup_packet_number_ = connection()->packet_number_of_last_sent_packet();
194 } 194 }
195 195
196 bool QuicServerSessionBase::ShouldCreateIncomingDynamicStream(QuicStreamId id) { 196 bool QuicServerSessionBase::ShouldCreateIncomingDynamicStream(QuicStreamId id) {
197 if (!connection()->connected()) { 197 if (!connection()->connected()) {
198 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected"; 198 QUIC_BUG << "ShouldCreateIncomingDynamicStream called when disconnected";
199 return false; 199 return false;
200 } 200 }
201 201
202 if (id % 2 == 0) { 202 if (id % 2 == 0) {
203 DVLOG(1) << "Invalid incoming even stream_id:" << id; 203 QUIC_DLOG(INFO) << "Invalid incoming even stream_id:" << id;
204 connection()->CloseConnection( 204 connection()->CloseConnection(
205 QUIC_INVALID_STREAM_ID, "Client created even numbered stream", 205 QUIC_INVALID_STREAM_ID, "Client created even numbered stream",
206 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 206 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
207 return false; 207 return false;
208 } 208 }
209 return true; 209 return true;
210 } 210 }
211 211
212 bool QuicServerSessionBase::ShouldCreateOutgoingDynamicStream() { 212 bool QuicServerSessionBase::ShouldCreateOutgoingDynamicStream() {
213 if (!connection()->connected()) { 213 if (!connection()->connected()) {
(...skipping 18 matching lines...) Expand all
232 232
233 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond( 233 int32_t QuicServerSessionBase::BandwidthToCachedParameterBytesPerSecond(
234 const QuicBandwidth& bandwidth) { 234 const QuicBandwidth& bandwidth) {
235 int64_t bytes_per_second = bandwidth.ToBytesPerSecond(); 235 int64_t bytes_per_second = bandwidth.ToBytesPerSecond();
236 return (bytes_per_second > static_cast<int64_t>(INT32_MAX) 236 return (bytes_per_second > static_cast<int64_t>(INT32_MAX)
237 ? INT32_MAX 237 ? INT32_MAX
238 : static_cast<int32_t>(bytes_per_second)); 238 : static_cast<int32_t>(bytes_per_second));
239 } 239 }
240 240
241 } // namespace net 241 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_server_id.cc ('k') | net/quic/core/quic_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698