| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "net/quic/core/crypto/proof_verifier.h" | 11 #include "net/quic/core/crypto/proof_verifier.h" |
| 12 #include "net/quic/core/quic_bug_tracker.h" | 12 #include "net/quic/core/quic_bug_tracker.h" |
| 13 #include "net/quic/core/quic_connection.h" | 13 #include "net/quic/core/quic_connection.h" |
| 14 #include "net/quic/core/quic_flags.h" | 14 #include "net/quic/core/quic_flags.h" |
| 15 #include "net/quic/core/quic_flow_controller.h" | 15 #include "net/quic/core/quic_flow_controller.h" |
| 16 #include "net/ssl/ssl_info.h" | 16 #include "net/ssl/ssl_info.h" |
| 17 | 17 |
| 18 using base::IntToString; | 18 using base::IntToString; |
| 19 using base::StringPiece; | 19 using base::StringPiece; |
| 20 using std::make_pair; | 20 using std::make_pair; |
| 21 using std::map; | |
| 22 using std::max; | 21 using std::max; |
| 23 using std::string; | 22 using std::string; |
| 24 using std::vector; | |
| 25 using net::SpdyPriority; | 23 using net::SpdyPriority; |
| 26 | 24 |
| 27 namespace net { | 25 namespace net { |
| 28 | 26 |
| 29 #define ENDPOINT \ | 27 #define ENDPOINT \ |
| 30 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") | 28 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") |
| 31 | 29 |
| 32 QuicSession::QuicSession(QuicConnection* connection, | 30 QuicSession::QuicSession(QuicConnection* connection, |
| 33 Visitor* owner, | 31 Visitor* owner, |
| 34 const QuicConfig& config) | 32 const QuicConfig& config) |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 draining_streams_.erase(stream_id); | 389 draining_streams_.erase(stream_id); |
| 392 | 390 |
| 393 stream->OnClose(); | 391 stream->OnClose(); |
| 394 // Decrease the number of streams being emulated when a new one is opened. | 392 // Decrease the number of streams being emulated when a new one is opened. |
| 395 connection_->SetNumOpenStreams(dynamic_stream_map_.size()); | 393 connection_->SetNumOpenStreams(dynamic_stream_map_.size()); |
| 396 } | 394 } |
| 397 | 395 |
| 398 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 396 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
| 399 QuicStreamId stream_id, | 397 QuicStreamId stream_id, |
| 400 QuicStreamOffset final_byte_offset) { | 398 QuicStreamOffset final_byte_offset) { |
| 401 map<QuicStreamId, QuicStreamOffset>::iterator it = | 399 std::map<QuicStreamId, QuicStreamOffset>::iterator it = |
| 402 locally_closed_streams_highest_offset_.find(stream_id); | 400 locally_closed_streams_highest_offset_.find(stream_id); |
| 403 if (it == locally_closed_streams_highest_offset_.end()) { | 401 if (it == locally_closed_streams_highest_offset_.end()) { |
| 404 return; | 402 return; |
| 405 } | 403 } |
| 406 | 404 |
| 407 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset | 405 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset |
| 408 << " for stream " << stream_id; | 406 << " for stream " << stream_id; |
| 409 QuicByteCount offset_diff = final_byte_offset - it->second; | 407 QuicByteCount offset_diff = final_byte_offset - it->second; |
| 410 if (flow_controller_.UpdateHighestReceivedOffset( | 408 if (flow_controller_.UpdateHighestReceivedOffset( |
| 411 flow_controller_.highest_received_byte_offset() + offset_diff)) { | 409 flow_controller_.highest_received_byte_offset() + offset_diff)) { |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 | 819 |
| 822 size_t QuicSession::MaxAvailableStreams() const { | 820 size_t QuicSession::MaxAvailableStreams() const { |
| 823 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 821 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
| 824 } | 822 } |
| 825 | 823 |
| 826 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 824 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
| 827 return id % 2 != next_outgoing_stream_id_ % 2; | 825 return id % 2 != next_outgoing_stream_id_ % 2; |
| 828 } | 826 } |
| 829 | 827 |
| 830 } // namespace net | 828 } // namespace net |
| OLD | NEW |