OLD | NEW |
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 int remaining_writes = write_blocked_streams_.NumBlockedStreams(); | 274 int remaining_writes = write_blocked_streams_.NumBlockedStreams(); |
275 | 275 |
276 while (!connection_->HasQueuedData() && | 276 while (!connection_->HasQueuedData() && |
277 remaining_writes > 0) { | 277 remaining_writes > 0) { |
278 DCHECK(write_blocked_streams_.HasWriteBlockedStreams()); | 278 DCHECK(write_blocked_streams_.HasWriteBlockedStreams()); |
279 if (!write_blocked_streams_.HasWriteBlockedStreams()) { | 279 if (!write_blocked_streams_.HasWriteBlockedStreams()) { |
280 LOG(DFATAL) << "WriteBlockedStream is missing"; | 280 LOG(DFATAL) << "WriteBlockedStream is missing"; |
281 connection_->CloseConnection(QUIC_INTERNAL_ERROR, false); | 281 connection_->CloseConnection(QUIC_INTERNAL_ERROR, false); |
282 return true; // We have no write blocked streams. | 282 return true; // We have no write blocked streams. |
283 } | 283 } |
284 int index = write_blocked_streams_.GetHighestPriorityWriteBlockedList(); | 284 QuicStreamId stream_id = write_blocked_streams_.PopFront(); |
285 QuicStreamId stream_id = write_blocked_streams_.PopFront(index); | |
286 if (stream_id == kCryptoStreamId) { | 285 if (stream_id == kCryptoStreamId) { |
287 has_pending_handshake_ = false; // We just popped it. | 286 has_pending_handshake_ = false; // We just popped it. |
288 } | 287 } |
289 ReliableQuicStream* stream = GetStream(stream_id); | 288 ReliableQuicStream* stream = GetStream(stream_id); |
290 if (stream != NULL) { | 289 if (stream != NULL) { |
291 // If the stream can't write all bytes, it'll re-add itself to the blocked | 290 // If the stream can't write all bytes, it'll re-add itself to the blocked |
292 // list. | 291 // list. |
293 stream->OnCanWrite(); | 292 stream->OnCanWrite(); |
294 } | 293 } |
295 --remaining_writes; | 294 --remaining_writes; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 #endif | 603 #endif |
605 | 604 |
606 if (id == kCryptoStreamId) { | 605 if (id == kCryptoStreamId) { |
607 DCHECK(!has_pending_handshake_); | 606 DCHECK(!has_pending_handshake_); |
608 has_pending_handshake_ = true; | 607 has_pending_handshake_ = true; |
609 // TODO(jar): Be sure to use the highest priority for the crypto stream, | 608 // TODO(jar): Be sure to use the highest priority for the crypto stream, |
610 // perhaps by adding a "special" priority for it that is higher than | 609 // perhaps by adding a "special" priority for it that is higher than |
611 // kHighestPriority. | 610 // kHighestPriority. |
612 priority = kHighestPriority; | 611 priority = kHighestPriority; |
613 } | 612 } |
614 write_blocked_streams_.PushBack(id, priority); | 613 write_blocked_streams_.PushBack(id, priority, connection()->version()); |
615 } | 614 } |
616 | 615 |
617 bool QuicSession::HasQueuedData() const { | 616 bool QuicSession::HasQueuedData() const { |
618 return write_blocked_streams_.NumBlockedStreams() || | 617 return write_blocked_streams_.HasWriteBlockedStreams() || |
619 connection_->HasQueuedData(); | 618 connection_->HasQueuedData(); |
620 } | 619 } |
621 | 620 |
622 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id, | 621 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id, |
623 QuicStreamId stream_id) { | 622 QuicStreamId stream_id) { |
624 DCHECK_GE(QUIC_VERSION_12, connection()->version()); | 623 DCHECK_GE(QUIC_VERSION_12, connection()->version()); |
625 decompression_blocked_streams_[header_id] = stream_id; | 624 decompression_blocked_streams_[header_id] = stream_id; |
626 } | 625 } |
627 | 626 |
628 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) { | 627 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) { |
629 NOTIMPLEMENTED(); | 628 NOTIMPLEMENTED(); |
630 return false; | 629 return false; |
631 } | 630 } |
632 | 631 |
633 void QuicSession::PostProcessAfterData() { | 632 void QuicSession::PostProcessAfterData() { |
634 STLDeleteElements(&closed_streams_); | 633 STLDeleteElements(&closed_streams_); |
635 closed_streams_.clear(); | 634 closed_streams_.clear(); |
636 } | 635 } |
637 | 636 |
638 } // namespace net | 637 } // namespace net |
OLD | NEW |