Chromium Code Reviews| 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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 case RST_STREAM_SETTINGS_TIMEOUT: | 406 case RST_STREAM_SETTINGS_TIMEOUT: |
| 407 return STATUS_CODE_SETTINGS_TIMEOUT; | 407 return STATUS_CODE_SETTINGS_TIMEOUT; |
| 408 case RST_STREAM_CONNECT_ERROR: | 408 case RST_STREAM_CONNECT_ERROR: |
| 409 return STATUS_CODE_CONNECT_ERROR; | 409 return STATUS_CODE_CONNECT_ERROR; |
| 410 case RST_STREAM_ENHANCE_YOUR_CALM: | 410 case RST_STREAM_ENHANCE_YOUR_CALM: |
| 411 return STATUS_CODE_ENHANCE_YOUR_CALM; | 411 return STATUS_CODE_ENHANCE_YOUR_CALM; |
| 412 case RST_STREAM_INADEQUATE_SECURITY: | 412 case RST_STREAM_INADEQUATE_SECURITY: |
| 413 return STATUS_CODE_INADEQUATE_SECURITY; | 413 return STATUS_CODE_INADEQUATE_SECURITY; |
| 414 case RST_STREAM_HTTP_1_1_REQUIRED: | 414 case RST_STREAM_HTTP_1_1_REQUIRED: |
| 415 return STATUS_CODE_HTTP_1_1_REQUIRED; | 415 return STATUS_CODE_HTTP_1_1_REQUIRED; |
| 416 case RST_STREAM_NO_ERROR: | |
| 417 return STATUS_CODE_NO_ERROR; | |
| 416 default: | 418 default: |
| 417 NOTREACHED(); | 419 NOTREACHED(); |
| 418 return static_cast<SpdyProtocolErrorDetails>(-1); | 420 return static_cast<SpdyProtocolErrorDetails>(-1); |
| 419 } | 421 } |
| 420 } | 422 } |
| 421 | 423 |
| 422 SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) { | 424 SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) { |
| 423 switch (err) { | 425 switch (err) { |
| 424 case OK: | 426 case OK: |
| 425 return GOAWAY_NO_ERROR; | 427 return GOAWAY_NO_ERROR; |
| (...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2320 | 2322 |
| 2321 ActiveStreamMap::iterator it = active_streams_.find(stream_id); | 2323 ActiveStreamMap::iterator it = active_streams_.find(stream_id); |
| 2322 if (it == active_streams_.end()) { | 2324 if (it == active_streams_.end()) { |
| 2323 // NOTE: it may just be that the stream was cancelled. | 2325 // NOTE: it may just be that the stream was cancelled. |
| 2324 LOG(WARNING) << "Received RST for invalid stream" << stream_id; | 2326 LOG(WARNING) << "Received RST for invalid stream" << stream_id; |
| 2325 return; | 2327 return; |
| 2326 } | 2328 } |
| 2327 | 2329 |
| 2328 CHECK_EQ(it->second.stream->stream_id(), stream_id); | 2330 CHECK_EQ(it->second.stream->stream_id(), stream_id); |
| 2329 | 2331 |
| 2330 if (status == 0) { | 2332 if (status == RST_STREAM_NO_ERROR) { |
|
xunjieli
2016/10/25 17:12:49
The new code got rid of handling of status == 0 (R
Bence
2016/10/25 22:11:24
I changed the value of RST_STREAM_NO_ERROR to 0, s
| |
| 2331 it->second.stream->OnDataReceived(std::unique_ptr<SpdyBuffer>()); | 2333 CloseActiveStreamIterator(it, ERR_SPDY_RST_STREAM_NO_ERROR_RECEIVED); |
| 2332 } else if (status == RST_STREAM_REFUSED_STREAM) { | 2334 } else if (status == RST_STREAM_REFUSED_STREAM) { |
| 2333 CloseActiveStreamIterator(it, ERR_SPDY_SERVER_REFUSED_STREAM); | 2335 CloseActiveStreamIterator(it, ERR_SPDY_SERVER_REFUSED_STREAM); |
| 2334 } else if (status == RST_STREAM_HTTP_1_1_REQUIRED) { | 2336 } else if (status == RST_STREAM_HTTP_1_1_REQUIRED) { |
| 2335 // TODO(bnc): Record histogram with number of open streams capped at 50. | 2337 // TODO(bnc): Record histogram with number of open streams capped at 50. |
| 2336 it->second.stream->LogStreamError( | 2338 it->second.stream->LogStreamError( |
| 2337 ERR_HTTP_1_1_REQUIRED, | 2339 ERR_HTTP_1_1_REQUIRED, |
| 2338 base::StringPrintf( | 2340 base::StringPrintf( |
| 2339 "SPDY session closed because of stream with status: %d", status)); | 2341 "SPDY session closed because of stream with status: %d", status)); |
| 2340 DoDrainSession(ERR_HTTP_1_1_REQUIRED, "HTTP_1_1_REQUIRED for stream."); | 2342 DoDrainSession(ERR_HTTP_1_1_REQUIRED, "HTTP_1_1_REQUIRED for stream."); |
| 2341 } else { | 2343 } else { |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3116 if (!queue->empty()) { | 3118 if (!queue->empty()) { |
| 3117 SpdyStreamId stream_id = queue->front(); | 3119 SpdyStreamId stream_id = queue->front(); |
| 3118 queue->pop_front(); | 3120 queue->pop_front(); |
| 3119 return stream_id; | 3121 return stream_id; |
| 3120 } | 3122 } |
| 3121 } | 3123 } |
| 3122 return 0; | 3124 return 0; |
| 3123 } | 3125 } |
| 3124 | 3126 |
| 3125 } // namespace net | 3127 } // namespace net |
| OLD | NEW |