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_flags.h" | 10 #include "net/quic/quic_flags.h" |
11 #include "net/quic/quic_flow_controller.h" | 11 #include "net/quic/quic_flow_controller.h" |
12 #include "net/ssl/ssl_info.h" | 12 #include "net/ssl/ssl_info.h" |
13 | 13 |
14 using base::StringPiece; | 14 using base::StringPiece; |
15 using base::hash_map; | 15 using base::hash_map; |
16 using base::hash_set; | 16 using base::hash_set; |
17 using std::make_pair; | 17 using std::make_pair; |
18 using std::map; | 18 using std::map; |
19 using std::max; | 19 using std::max; |
20 using std::string; | 20 using std::string; |
21 using std::vector; | 21 using std::vector; |
| 22 using net::SpdyPriority; |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 | 25 |
25 #define ENDPOINT \ | 26 #define ENDPOINT \ |
26 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") | 27 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") |
27 | 28 |
28 // We want to make sure we delete any closed streams in a safe manner. | 29 // We want to make sure we delete any closed streams in a safe manner. |
29 // To avoid deleting a stream in mid-operation, we have a simple shim between | 30 // To avoid deleting a stream in mid-operation, we have a simple shim between |
30 // us and the stream, so we can delete any streams when we return from | 31 // us and the stream, so we can delete any streams when we return from |
31 // processing. | 32 // processing. |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 728 |
728 size_t QuicSession::GetNumActiveStreams() const { | 729 size_t QuicSession::GetNumActiveStreams() const { |
729 return GetNumOpenStreams() - locally_closed_streams_highest_offset_.size(); | 730 return GetNumOpenStreams() - locally_closed_streams_highest_offset_.size(); |
730 } | 731 } |
731 | 732 |
732 size_t QuicSession::GetNumAvailableStreams() const { | 733 size_t QuicSession::GetNumAvailableStreams() const { |
733 return available_streams_.size(); | 734 return available_streams_.size(); |
734 } | 735 } |
735 | 736 |
736 void QuicSession::MarkConnectionLevelWriteBlocked(QuicStreamId id, | 737 void QuicSession::MarkConnectionLevelWriteBlocked(QuicStreamId id, |
737 QuicPriority priority) { | 738 SpdyPriority priority) { |
738 #ifndef NDEBUG | 739 #ifndef NDEBUG |
739 ReliableQuicStream* stream = GetStream(id); | 740 ReliableQuicStream* stream = GetStream(id); |
740 if (stream != nullptr) { | 741 if (stream != nullptr) { |
741 LOG_IF(DFATAL, priority != stream->Priority()) | 742 LOG_IF(DFATAL, priority != stream->Priority()) |
742 << ENDPOINT << "Stream " << id | 743 << ENDPOINT << "Stream " << id |
743 << "Priorities do not match. Got: " << priority | 744 << "Priorities do not match. Got: " << static_cast<int>(priority) |
744 << " Expected: " << stream->Priority(); | 745 << " Expected: " << static_cast<int>(stream->Priority()); |
745 } else { | 746 } else { |
746 LOG(DFATAL) << "Marking unknown stream " << id << " blocked."; | 747 LOG(DFATAL) << "Marking unknown stream " << id << " blocked."; |
747 } | 748 } |
748 #endif | 749 #endif |
749 | 750 |
750 if (id == kCryptoStreamId) { | 751 if (id == kCryptoStreamId) { |
751 DCHECK(!has_pending_handshake_); | 752 DCHECK(!has_pending_handshake_); |
752 has_pending_handshake_ = true; | 753 has_pending_handshake_ = true; |
753 // TODO(jar): Be sure to use the highest priority for the crypto stream, | 754 // TODO(jar): Be sure to use the highest priority for the crypto stream, |
754 // perhaps by adding a "special" priority for it that is higher than | 755 // perhaps by adding a "special" priority for it that is higher than |
(...skipping 26 matching lines...) Expand all Loading... |
781 } | 782 } |
782 for (auto const& kv : dynamic_stream_map_) { | 783 for (auto const& kv : dynamic_stream_map_) { |
783 if (kv.second->flow_controller()->IsBlocked()) { | 784 if (kv.second->flow_controller()->IsBlocked()) { |
784 return true; | 785 return true; |
785 } | 786 } |
786 } | 787 } |
787 return false; | 788 return false; |
788 } | 789 } |
789 | 790 |
790 } // namespace net | 791 } // namespace net |
OLD | NEW |