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/core/quic_session.h" | 5 #include "net/quic/core/quic_session.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "net/quic/core/crypto/proof_verifier.h" | 10 #include "net/quic/core/crypto/proof_verifier.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 config_(config), | 33 config_(config), |
34 max_open_outgoing_streams_(kDefaultMaxStreamsPerConnection), | 34 max_open_outgoing_streams_(kDefaultMaxStreamsPerConnection), |
35 max_open_incoming_streams_(config_.GetMaxIncomingDynamicStreamsToSend()), | 35 max_open_incoming_streams_(config_.GetMaxIncomingDynamicStreamsToSend()), |
36 next_outgoing_stream_id_(perspective() == Perspective::IS_SERVER ? 2 : 3), | 36 next_outgoing_stream_id_(perspective() == Perspective::IS_SERVER ? 2 : 3), |
37 largest_peer_created_stream_id_( | 37 largest_peer_created_stream_id_( |
38 perspective() == Perspective::IS_SERVER ? 1 : 0), | 38 perspective() == Perspective::IS_SERVER ? 1 : 0), |
39 num_dynamic_incoming_streams_(0), | 39 num_dynamic_incoming_streams_(0), |
40 num_draining_incoming_streams_(0), | 40 num_draining_incoming_streams_(0), |
41 num_locally_closed_incoming_streams_highest_offset_(0), | 41 num_locally_closed_incoming_streams_highest_offset_(0), |
42 error_(QUIC_NO_ERROR), | 42 error_(QUIC_NO_ERROR), |
43 flow_controller_(connection_.get(), | 43 flow_controller_(connection_, |
44 0, | 44 0, |
45 perspective(), | 45 perspective(), |
46 kMinimumFlowControlSendWindow, | 46 kMinimumFlowControlSendWindow, |
47 config_.GetInitialSessionFlowControlWindowToSend(), | 47 config_.GetInitialSessionFlowControlWindowToSend(), |
48 perspective() == Perspective::IS_SERVER), | 48 perspective() == Perspective::IS_SERVER), |
49 currently_writing_stream_id_(0) {} | 49 currently_writing_stream_id_(0) {} |
50 | 50 |
51 void QuicSession::Initialize() { | 51 void QuicSession::Initialize() { |
52 connection_->set_visitor(this); | 52 connection_->set_visitor(this); |
53 connection_->SetFromConfig(config_); | 53 connection_->SetFromConfig(config_); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 if (write_blocked_streams_.headers_stream_blocked()) { | 179 if (write_blocked_streams_.headers_stream_blocked()) { |
180 num_writes += 1; | 180 num_writes += 1; |
181 } | 181 } |
182 } | 182 } |
183 if (num_writes == 0) { | 183 if (num_writes == 0) { |
184 return; | 184 return; |
185 } | 185 } |
186 | 186 |
187 QuicConnection::ScopedPacketBundler ack_bundler( | 187 QuicConnection::ScopedPacketBundler ack_bundler( |
188 connection_.get(), QuicConnection::SEND_ACK_IF_QUEUED); | 188 connection_, QuicConnection::SEND_ACK_IF_QUEUED); |
189 for (size_t i = 0; i < num_writes; ++i) { | 189 for (size_t i = 0; i < num_writes; ++i) { |
190 if (!(write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() || | 190 if (!(write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() || |
191 write_blocked_streams_.HasWriteBlockedDataStreams())) { | 191 write_blocked_streams_.HasWriteBlockedDataStreams())) { |
192 // Writing one stream removed another!? Something's broken. | 192 // Writing one stream removed another!? Something's broken. |
193 QUIC_BUG << "WriteBlockedStream is missing"; | 193 QUIC_BUG << "WriteBlockedStream is missing"; |
194 connection_->CloseConnection(QUIC_INTERNAL_ERROR, | 194 connection_->CloseConnection(QUIC_INTERNAL_ERROR, |
195 "WriteBlockedStream is missing", | 195 "WriteBlockedStream is missing", |
196 ConnectionCloseBehavior::SILENT_CLOSE); | 196 ConnectionCloseBehavior::SILENT_CLOSE); |
197 return; | 197 return; |
198 } | 198 } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 size_t QuicSession::MaxAvailableStreams() const { | 766 size_t QuicSession::MaxAvailableStreams() const { |
767 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 767 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
768 } | 768 } |
769 | 769 |
770 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 770 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
771 return id % 2 != next_outgoing_stream_id_ % 2; | 771 return id % 2 != next_outgoing_stream_id_ % 2; |
772 } | 772 } |
773 | 773 |
774 } // namespace net | 774 } // namespace net |
OLD | NEW |