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

Side by Side Diff: net/tools/quic/quic_simple_server_session.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/tools/quic/quic_server_test.cc ('k') | net/tools/quic/quic_simple_server_stream.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/tools/quic/quic_simple_server_session.h" 5 #include "net/tools/quic/quic_simple_server_session.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
11 #include "net/quic/core/proto/cached_network_parameters.pb.h" 10 #include "net/quic/core/proto/cached_network_parameters.pb.h"
12 #include "net/quic/core/quic_connection.h" 11 #include "net/quic/core/quic_connection.h"
13 #include "net/quic/core/quic_flags.h" 12 #include "net/quic/core/quic_flags.h"
14 #include "net/quic/core/quic_spdy_session.h" 13 #include "net/quic/core/quic_spdy_session.h"
14 #include "net/quic/platform/api/quic_logging.h"
15 #include "net/tools/quic/quic_simple_server_stream.h" 15 #include "net/tools/quic/quic_simple_server_stream.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 using std::string; 18 using std::string;
19 19
20 namespace net { 20 namespace net {
21 21
22 QuicSimpleServerSession::QuicSimpleServerSession( 22 QuicSimpleServerSession::QuicSimpleServerSession(
23 const QuicConfig& config, 23 const QuicConfig& config,
24 QuicConnection* connection, 24 QuicConnection* connection,
(...skipping 27 matching lines...) Expand all
52 52
53 void QuicSimpleServerSession::StreamDraining(QuicStreamId id) { 53 void QuicSimpleServerSession::StreamDraining(QuicStreamId id) {
54 QuicSpdySession::StreamDraining(id); 54 QuicSpdySession::StreamDraining(id);
55 if (!IsIncomingStream(id)) { 55 if (!IsIncomingStream(id)) {
56 HandlePromisedPushRequests(); 56 HandlePromisedPushRequests();
57 } 57 }
58 } 58 }
59 59
60 void QuicSimpleServerSession::OnStreamFrame(const QuicStreamFrame& frame) { 60 void QuicSimpleServerSession::OnStreamFrame(const QuicStreamFrame& frame) {
61 if (!IsIncomingStream(frame.stream_id)) { 61 if (!IsIncomingStream(frame.stream_id)) {
62 LOG(WARNING) << "Client shouldn't send data on server push stream"; 62 QUIC_LOG(WARNING) << "Client shouldn't send data on server push stream";
63 connection()->CloseConnection( 63 connection()->CloseConnection(
64 QUIC_INVALID_STREAM_ID, "Client sent data on server push stream", 64 QUIC_INVALID_STREAM_ID, "Client sent data on server push stream",
65 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 65 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
66 return; 66 return;
67 } 67 }
68 QuicSpdySession::OnStreamFrame(frame); 68 QuicSpdySession::OnStreamFrame(frame);
69 } 69 }
70 70
71 void QuicSimpleServerSession::PromisePushResources( 71 void QuicSimpleServerSession::PromisePushResources(
72 const string& request_url, 72 const string& request_url,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 spdy_headers["content-length"] = "0"; 170 spdy_headers["content-length"] = "0";
171 // Remove "host" field as push request is a directly generated HTTP2 request 171 // Remove "host" field as push request is a directly generated HTTP2 request
172 // which should use ":authority" instead of "host". 172 // which should use ":authority" instead of "host".
173 spdy_headers.erase("host"); 173 spdy_headers.erase("host");
174 return spdy_headers; 174 return spdy_headers;
175 } 175 }
176 176
177 void QuicSimpleServerSession::SendPushPromise(QuicStreamId original_stream_id, 177 void QuicSimpleServerSession::SendPushPromise(QuicStreamId original_stream_id,
178 QuicStreamId promised_stream_id, 178 QuicStreamId promised_stream_id,
179 SpdyHeaderBlock headers) { 179 SpdyHeaderBlock headers) {
180 DVLOG(1) << "stream " << original_stream_id 180 QUIC_DLOG(INFO) << "stream " << original_stream_id
181 << " send PUSH_PROMISE for promised stream " << promised_stream_id; 181 << " send PUSH_PROMISE for promised stream "
182 << promised_stream_id;
182 WritePushPromise(original_stream_id, promised_stream_id, std::move(headers)); 183 WritePushPromise(original_stream_id, promised_stream_id, std::move(headers));
183 } 184 }
184 185
185 void QuicSimpleServerSession::HandlePromisedPushRequests() { 186 void QuicSimpleServerSession::HandlePromisedPushRequests() {
186 while (!promised_streams_.empty() && ShouldCreateOutgoingDynamicStream()) { 187 while (!promised_streams_.empty() && ShouldCreateOutgoingDynamicStream()) {
187 PromisedStreamInfo& promised_info = promised_streams_.front(); 188 PromisedStreamInfo& promised_info = promised_streams_.front();
188 DCHECK_EQ(next_outgoing_stream_id(), promised_info.stream_id); 189 DCHECK_EQ(next_outgoing_stream_id(), promised_info.stream_id);
189 190
190 if (promised_info.is_cancelled) { 191 if (promised_info.is_cancelled) {
191 // This stream has been reset by client. Skip this stream id. 192 // This stream has been reset by client. Skip this stream id.
192 promised_streams_.pop_front(); 193 promised_streams_.pop_front();
193 GetNextOutgoingStreamId(); 194 GetNextOutgoingStreamId();
194 return; 195 return;
195 } 196 }
196 197
197 QuicSimpleServerStream* promised_stream = 198 QuicSimpleServerStream* promised_stream =
198 static_cast<QuicSimpleServerStream*>( 199 static_cast<QuicSimpleServerStream*>(
199 CreateOutgoingDynamicStream(promised_info.priority)); 200 CreateOutgoingDynamicStream(promised_info.priority));
200 DCHECK(promised_stream != nullptr); 201 DCHECK(promised_stream != nullptr);
201 DCHECK_EQ(promised_info.stream_id, promised_stream->id()); 202 DCHECK_EQ(promised_info.stream_id, promised_stream->id());
202 DVLOG(1) << "created server push stream " << promised_stream->id(); 203 QUIC_DLOG(INFO) << "created server push stream " << promised_stream->id();
203 204
204 SpdyHeaderBlock request_headers(std::move(promised_info.request_headers)); 205 SpdyHeaderBlock request_headers(std::move(promised_info.request_headers));
205 206
206 promised_streams_.pop_front(); 207 promised_streams_.pop_front();
207 promised_stream->PushResponse(std::move(request_headers)); 208 promised_stream->PushResponse(std::move(request_headers));
208 } 209 }
209 } 210 }
210 211
211 } // namespace net 212 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_test.cc ('k') | net/tools/quic/quic_simple_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698