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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS: | 399 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS: |
| 400 return SPDY_ERROR_INVALID_CONTROL_FRAME_FLAGS; | 400 return SPDY_ERROR_INVALID_CONTROL_FRAME_FLAGS; |
| 401 case SpdyFramer::SPDY_UNEXPECTED_FRAME: | 401 case SpdyFramer::SPDY_UNEXPECTED_FRAME: |
| 402 return SPDY_ERROR_UNEXPECTED_FRAME; | 402 return SPDY_ERROR_UNEXPECTED_FRAME; |
| 403 case SpdyFramer::SPDY_INTERNAL_FRAMER_ERROR: | 403 case SpdyFramer::SPDY_INTERNAL_FRAMER_ERROR: |
| 404 return SPDY_ERROR_INTERNAL_FRAMER_ERROR; | 404 return SPDY_ERROR_INTERNAL_FRAMER_ERROR; |
| 405 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE: | 405 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE: |
| 406 return SPDY_ERROR_INVALID_CONTROL_FRAME_SIZE; | 406 return SPDY_ERROR_INVALID_CONTROL_FRAME_SIZE; |
| 407 case SpdyFramer::SPDY_OVERSIZED_PAYLOAD: | 407 case SpdyFramer::SPDY_OVERSIZED_PAYLOAD: |
| 408 return SPDY_ERROR_OVERSIZED_PAYLOAD; | 408 return SPDY_ERROR_OVERSIZED_PAYLOAD; |
| 409 default: | 409 case SpdyFramer::LAST_ERROR: |
| 410 NOTREACHED(); | 410 NOTREACHED(); |
| 411 return static_cast<SpdyProtocolErrorDetails>(-1); | |
| 412 } | 411 } |
| 412 return static_cast<SpdyProtocolErrorDetails>(-1); | |
|
Bence
2017/02/02 23:19:12
Did you not want to add NOTREACHED() right above t
| |
| 413 } | 413 } |
| 414 | 414 |
| 415 Error MapFramerErrorToNetError(SpdyFramer::SpdyFramerError err) { | 415 Error MapFramerErrorToNetError(SpdyFramer::SpdyFramerError err) { |
| 416 switch (err) { | 416 switch (err) { |
| 417 case SpdyFramer::SPDY_NO_ERROR: | 417 case SpdyFramer::SPDY_NO_ERROR: |
| 418 return OK; | 418 return OK; |
| 419 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME: | 419 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME: |
| 420 return ERR_SPDY_PROTOCOL_ERROR; | 420 return ERR_SPDY_PROTOCOL_ERROR; |
| 421 case SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE: | 421 case SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE: |
| 422 return ERR_SPDY_FRAME_SIZE_ERROR; | 422 return ERR_SPDY_FRAME_SIZE_ERROR; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 439 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS: | 439 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS: |
| 440 return ERR_SPDY_PROTOCOL_ERROR; | 440 return ERR_SPDY_PROTOCOL_ERROR; |
| 441 case SpdyFramer::SPDY_UNEXPECTED_FRAME: | 441 case SpdyFramer::SPDY_UNEXPECTED_FRAME: |
| 442 return ERR_SPDY_PROTOCOL_ERROR; | 442 return ERR_SPDY_PROTOCOL_ERROR; |
| 443 case SpdyFramer::SPDY_INTERNAL_FRAMER_ERROR: | 443 case SpdyFramer::SPDY_INTERNAL_FRAMER_ERROR: |
| 444 return ERR_SPDY_PROTOCOL_ERROR; | 444 return ERR_SPDY_PROTOCOL_ERROR; |
| 445 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE: | 445 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE: |
| 446 return ERR_SPDY_FRAME_SIZE_ERROR; | 446 return ERR_SPDY_FRAME_SIZE_ERROR; |
| 447 case SpdyFramer::SPDY_INVALID_STREAM_ID: | 447 case SpdyFramer::SPDY_INVALID_STREAM_ID: |
| 448 return ERR_SPDY_PROTOCOL_ERROR; | 448 return ERR_SPDY_PROTOCOL_ERROR; |
| 449 default: | 449 case SpdyFramer::SPDY_OVERSIZED_PAYLOAD: |
| 450 return ERR_SPDY_FRAME_SIZE_ERROR; | |
| 451 case SpdyFramer::LAST_ERROR: | |
| 450 NOTREACHED(); | 452 NOTREACHED(); |
| 451 return ERR_SPDY_PROTOCOL_ERROR; | |
| 452 } | 453 } |
| 454 return ERR_SPDY_PROTOCOL_ERROR; | |
| 453 } | 455 } |
| 454 | 456 |
| 455 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( | 457 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( |
| 456 SpdyRstStreamStatus status) { | 458 SpdyRstStreamStatus status) { |
| 457 switch (status) { | 459 switch (status) { |
| 458 case RST_STREAM_NO_ERROR: | 460 case RST_STREAM_NO_ERROR: |
| 459 return STATUS_CODE_NO_ERROR; | 461 return STATUS_CODE_NO_ERROR; |
| 460 case RST_STREAM_PROTOCOL_ERROR: | 462 case RST_STREAM_PROTOCOL_ERROR: |
| 461 return STATUS_CODE_PROTOCOL_ERROR; | 463 return STATUS_CODE_PROTOCOL_ERROR; |
| 462 case RST_STREAM_INTERNAL_ERROR: | 464 case RST_STREAM_INTERNAL_ERROR: |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 476 case RST_STREAM_COMPRESSION_ERROR: | 478 case RST_STREAM_COMPRESSION_ERROR: |
| 477 return STATUS_CODE_COMPRESSION_ERROR; | 479 return STATUS_CODE_COMPRESSION_ERROR; |
| 478 case RST_STREAM_CONNECT_ERROR: | 480 case RST_STREAM_CONNECT_ERROR: |
| 479 return STATUS_CODE_CONNECT_ERROR; | 481 return STATUS_CODE_CONNECT_ERROR; |
| 480 case RST_STREAM_ENHANCE_YOUR_CALM: | 482 case RST_STREAM_ENHANCE_YOUR_CALM: |
| 481 return STATUS_CODE_ENHANCE_YOUR_CALM; | 483 return STATUS_CODE_ENHANCE_YOUR_CALM; |
| 482 case RST_STREAM_INADEQUATE_SECURITY: | 484 case RST_STREAM_INADEQUATE_SECURITY: |
| 483 return STATUS_CODE_INADEQUATE_SECURITY; | 485 return STATUS_CODE_INADEQUATE_SECURITY; |
| 484 case RST_STREAM_HTTP_1_1_REQUIRED: | 486 case RST_STREAM_HTTP_1_1_REQUIRED: |
| 485 return STATUS_CODE_HTTP_1_1_REQUIRED; | 487 return STATUS_CODE_HTTP_1_1_REQUIRED; |
| 486 default: | 488 case RST_STREAM_NUM_STATUS_CODES: |
| 487 NOTREACHED(); | 489 NOTREACHED(); |
| 488 return static_cast<SpdyProtocolErrorDetails>(-1); | |
| 489 } | 490 } |
| 491 return static_cast<SpdyProtocolErrorDetails>(-1); | |
| 490 } | 492 } |
| 491 | 493 |
| 492 SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) { | 494 SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) { |
| 493 switch (err) { | 495 switch (err) { |
| 494 case OK: | 496 case OK: |
| 495 return GOAWAY_NO_ERROR; | 497 return GOAWAY_NO_ERROR; |
| 496 case ERR_SPDY_PROTOCOL_ERROR: | 498 case ERR_SPDY_PROTOCOL_ERROR: |
| 497 return GOAWAY_PROTOCOL_ERROR; | 499 return GOAWAY_PROTOCOL_ERROR; |
| 498 case ERR_SPDY_FLOW_CONTROL_ERROR: | 500 case ERR_SPDY_FLOW_CONTROL_ERROR: |
| 499 return GOAWAY_FLOW_CONTROL_ERROR; | 501 return GOAWAY_FLOW_CONTROL_ERROR; |
| (...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3119 if (!queue->empty()) { | 3121 if (!queue->empty()) { |
| 3120 SpdyStreamId stream_id = queue->front(); | 3122 SpdyStreamId stream_id = queue->front(); |
| 3121 queue->pop_front(); | 3123 queue->pop_front(); |
| 3122 return stream_id; | 3124 return stream_id; |
| 3123 } | 3125 } |
| 3124 } | 3126 } |
| 3125 return 0; | 3127 return 0; |
| 3126 } | 3128 } |
| 3127 | 3129 |
| 3128 } // namespace net | 3130 } // namespace net |
| OLD | NEW |