| 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/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 | 9 |
| 10 using base::StringPiece; | 10 using base::StringPiece; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // TODO(alyssar) check against existing connection address: if changed, make | 101 // TODO(alyssar) check against existing connection address: if changed, make |
| 102 // sure we update the connection. | 102 // sure we update the connection. |
| 103 } | 103 } |
| 104 | 104 |
| 105 for (size_t i = 0; i < frames.size(); ++i) { | 105 for (size_t i = 0; i < frames.size(); ++i) { |
| 106 ReliableQuicStream* stream = GetStream(frames[i].stream_id); | 106 ReliableQuicStream* stream = GetStream(frames[i].stream_id); |
| 107 if (stream) { | 107 if (stream) { |
| 108 stream->OnStreamFrame(frames[i]); | 108 stream->OnStreamFrame(frames[i]); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | |
| 112 while (!decompression_blocked_streams_.empty()) { | |
| 113 QuicHeaderId header_id = decompression_blocked_streams_.begin()->first; | |
| 114 if (header_id == decompressor_.current_header_id()) { | |
| 115 QuicStreamId stream_id = decompression_blocked_streams_.begin()->second; | |
| 116 decompression_blocked_streams_.erase(header_id); | |
| 117 ReliableQuicStream* stream = GetStream(stream_id); | |
| 118 if (!stream) { | |
| 119 connection()->SendConnectionClose( | |
| 120 QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED); | |
| 121 } | |
| 122 stream->OnDecompressorAvailable(); | |
| 123 } | |
| 124 } | |
| 125 return true; | 111 return true; |
| 126 } | 112 } |
| 127 | 113 |
| 128 void QuicSession::OnRstStream(const QuicRstStreamFrame& frame) { | 114 void QuicSession::OnRstStream(const QuicRstStreamFrame& frame) { |
| 129 ReliableQuicStream* stream = GetStream(frame.stream_id); | 115 ReliableQuicStream* stream = GetStream(frame.stream_id); |
| 130 if (!stream) { | 116 if (!stream) { |
| 131 return; // Errors are handled by GetStream. | 117 return; // Errors are handled by GetStream. |
| 132 } | 118 } |
| 133 stream->OnStreamReset(frame.error_code); | 119 stream->OnStreamReset(frame.error_code); |
| 134 } | 120 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 295 } |
| 310 | 296 |
| 311 size_t QuicSession::GetNumOpenStreams() const { | 297 size_t QuicSession::GetNumOpenStreams() const { |
| 312 return stream_map_.size() + implicitly_created_streams_.size(); | 298 return stream_map_.size() + implicitly_created_streams_.size(); |
| 313 } | 299 } |
| 314 | 300 |
| 315 void QuicSession::MarkWriteBlocked(QuicStreamId id) { | 301 void QuicSession::MarkWriteBlocked(QuicStreamId id) { |
| 316 write_blocked_streams_.AddBlockedObject(id); | 302 write_blocked_streams_.AddBlockedObject(id); |
| 317 } | 303 } |
| 318 | 304 |
| 319 void QuicSession::MarkDecompressionBlocked(QuicHeaderId header_id, | |
| 320 QuicStreamId stream_id) { | |
| 321 decompression_blocked_streams_[header_id] = stream_id; | |
| 322 } | |
| 323 | |
| 324 void QuicSession::PostProcessAfterData() { | 305 void QuicSession::PostProcessAfterData() { |
| 325 STLDeleteElements(&closed_streams_); | 306 STLDeleteElements(&closed_streams_); |
| 326 closed_streams_.clear(); | 307 closed_streams_.clear(); |
| 327 } | 308 } |
| 328 | 309 |
| 329 } // namespace net | 310 } // namespace net |
| OLD | NEW |