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

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

Issue 2850523002: QUIC: correctly update local stream state on receipt of trailers after sending RST. Protected by FL… (Closed)
Patch Set: Created 3 years, 7 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_session.cc ('k') | net/tools/quic/quic_client_session_test.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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_spdy_session.h" 5 #include "net/quic/core/quic_spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdint> 8 #include <cstdint>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "net/quic/core/quic_headers_stream.h" 12 #include "net/quic/core/quic_headers_stream.h"
13 #include "net/quic/platform/api/quic_bug_tracker.h" 13 #include "net/quic/platform/api/quic_bug_tracker.h"
14 #include "net/quic/platform/api/quic_flag_utils.h"
14 #include "net/quic/platform/api/quic_flags.h" 15 #include "net/quic/platform/api/quic_flags.h"
15 #include "net/quic/platform/api/quic_logging.h" 16 #include "net/quic/platform/api/quic_logging.h"
16 #include "net/quic/platform/api/quic_str_cat.h" 17 #include "net/quic/platform/api/quic_str_cat.h"
18 #include "net/quic/platform/api/quic_text_utils.h"
17 19
18 using std::string; 20 using std::string;
19 21
20 namespace net { 22 namespace net {
21 23
22 namespace { 24 namespace {
23 25
24 class HeaderTableDebugVisitor 26 class HeaderTableDebugVisitor
25 : public HpackHeaderTable::DebugVisitorInterface { 27 : public HpackHeaderTable::DebugVisitorInterface {
26 public: 28 public:
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return; 388 return;
387 } 389 }
388 stream->OnStreamHeadersPriority(priority); 390 stream->OnStreamHeadersPriority(priority);
389 } 391 }
390 392
391 void QuicSpdySession::OnStreamHeaderList(QuicStreamId stream_id, 393 void QuicSpdySession::OnStreamHeaderList(QuicStreamId stream_id,
392 bool fin, 394 bool fin,
393 size_t frame_len, 395 size_t frame_len,
394 const QuicHeaderList& header_list) { 396 const QuicHeaderList& header_list) {
395 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); 397 QuicSpdyStream* stream = GetSpdyDataStream(stream_id);
396 if (!stream) { 398 if (stream == nullptr) {
399 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_final_offset_from_trailers, 1,
400 3);
401 if (FLAGS_quic_reloadable_flag_quic_final_offset_from_trailers) {
402 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_final_offset_from_trailers, 2,
403 3);
404 // The stream no longer exists, but trailing headers may contain the final
405 // byte offset necessary for flow control and open stream accounting.
406 size_t final_byte_offset = 0;
407 for (const auto& header : header_list) {
408 const string& header_key = header.first;
409 const string& header_value = header.second;
410 if (header_key == kFinalOffsetHeaderKey) {
411 if (!QuicTextUtils::StringToSizeT(header_value, &final_byte_offset)) {
412 connection()->CloseConnection(
413 QUIC_INVALID_HEADERS_STREAM_DATA,
414 "Trailers are malformed (no final offset)",
415 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
416 return;
417 }
418 DVLOG(1) << "Received final byte offset in trailers for stream "
419 << stream_id << ", which no longer exists.";
420 OnFinalByteOffsetReceived(stream_id, final_byte_offset);
421 QUIC_FLAG_COUNT_N(
422 quic_reloadable_flag_quic_final_offset_from_trailers, 3, 3);
423 }
424 }
425 }
426
397 // It's quite possible to receive headers after a stream has been reset. 427 // It's quite possible to receive headers after a stream has been reset.
398 return; 428 return;
399 } 429 }
400 stream->OnStreamHeaderList(fin, frame_len, header_list); 430 stream->OnStreamHeaderList(fin, frame_len, header_list);
401 } 431 }
402 432
403 size_t QuicSpdySession::ProcessHeaderData(const struct iovec& iov, 433 size_t QuicSpdySession::ProcessHeaderData(const struct iovec& iov,
404 QuicTime timestamp) { 434 QuicTime timestamp) {
405 DCHECK(timestamp.IsInitialized()); 435 DCHECK(timestamp.IsInitialized());
406 UpdateCurMaxTimeStamp(timestamp); 436 UpdateCurMaxTimeStamp(timestamp);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 set_max_uncompressed_header_bytes); 797 set_max_uncompressed_header_bytes);
768 } 798 }
769 799
770 void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error, 800 void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error,
771 const string& details) { 801 const string& details) {
772 connection()->CloseConnection( 802 connection()->CloseConnection(
773 error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 803 error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
774 } 804 }
775 805
776 } // namespace net 806 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_session.cc ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698