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

Side by Side Diff: net/quic/quic_session.cc

Issue 139103002: Break out of the loop in QuicSession::OnCanWrite if the QuicConnection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_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) 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/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/crypto/proof_verifier.h" 8 #include "net/quic/crypto/proof_verifier.h"
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_headers_stream.h" 10 #include "net/quic/quic_headers_stream.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 CloseStream(id); 266 CloseStream(id);
267 } 267 }
268 } 268 }
269 } 269 }
270 270
271 bool QuicSession::OnCanWrite() { 271 bool QuicSession::OnCanWrite() {
272 // We latch this here rather than doing a traditional loop, because streams 272 // We latch this here rather than doing a traditional loop, because streams
273 // may be modifying the list as we loop. 273 // may be modifying the list as we loop.
274 int remaining_writes = write_blocked_streams_.NumBlockedStreams(); 274 int remaining_writes = write_blocked_streams_.NumBlockedStreams();
275 275
276 while (!connection_->HasQueuedData() && 276 while (remaining_writes > 0 && connection_->CanWriteStreamData()) {
277 remaining_writes > 0) {
278 DCHECK(write_blocked_streams_.HasWriteBlockedStreams()); 277 DCHECK(write_blocked_streams_.HasWriteBlockedStreams());
279 if (!write_blocked_streams_.HasWriteBlockedStreams()) { 278 if (!write_blocked_streams_.HasWriteBlockedStreams()) {
280 LOG(DFATAL) << "WriteBlockedStream is missing"; 279 LOG(DFATAL) << "WriteBlockedStream is missing";
281 connection_->CloseConnection(QUIC_INTERNAL_ERROR, false); 280 connection_->CloseConnection(QUIC_INTERNAL_ERROR, false);
282 return true; // We have no write blocked streams. 281 return true; // We have no write blocked streams.
283 } 282 }
284 QuicStreamId stream_id = write_blocked_streams_.PopFront(); 283 QuicStreamId stream_id = write_blocked_streams_.PopFront();
285 if (stream_id == kCryptoStreamId) { 284 if (stream_id == kCryptoStreamId) {
286 has_pending_handshake_ = false; // We just popped it. 285 has_pending_handshake_ = false; // We just popped it.
287 } 286 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 DCHECK(!has_pending_handshake_); 605 DCHECK(!has_pending_handshake_);
607 has_pending_handshake_ = true; 606 has_pending_handshake_ = true;
608 // TODO(jar): Be sure to use the highest priority for the crypto stream, 607 // TODO(jar): Be sure to use the highest priority for the crypto stream,
609 // perhaps by adding a "special" priority for it that is higher than 608 // perhaps by adding a "special" priority for it that is higher than
610 // kHighestPriority. 609 // kHighestPriority.
611 priority = kHighestPriority; 610 priority = kHighestPriority;
612 } 611 }
613 write_blocked_streams_.PushBack(id, priority, connection()->version()); 612 write_blocked_streams_.PushBack(id, priority, connection()->version());
614 } 613 }
615 614
616 bool QuicSession::HasQueuedData() const { 615 bool QuicSession::HasDataToWrite() const {
617 return write_blocked_streams_.HasWriteBlockedStreams() || 616 return write_blocked_streams_.HasWriteBlockedStreams() ||
618 connection_->HasQueuedData(); 617 connection_->HasQueuedData();
619 } 618 }
620 619
621 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id, 620 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id,
622 QuicStreamId stream_id) { 621 QuicStreamId stream_id) {
623 DCHECK_GE(QUIC_VERSION_12, connection()->version()); 622 DCHECK_GE(QUIC_VERSION_12, connection()->version());
624 decompression_blocked_streams_[header_id] = stream_id; 623 decompression_blocked_streams_[header_id] = stream_id;
625 } 624 }
626 625
627 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) { 626 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) {
628 NOTIMPLEMENTED(); 627 NOTIMPLEMENTED();
629 return false; 628 return false;
630 } 629 }
631 630
632 void QuicSession::PostProcessAfterData() { 631 void QuicSession::PostProcessAfterData() {
633 STLDeleteElements(&closed_streams_); 632 STLDeleteElements(&closed_streams_);
634 closed_streams_.clear(); 633 closed_streams_.clear();
635 } 634 }
636 635
637 } // namespace net 636 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698