| 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 NOTREACHED(); |
| 413 return static_cast<SpdyProtocolErrorDetails>(-1); |
| 413 } | 414 } |
| 414 | 415 |
| 415 Error MapFramerErrorToNetError(SpdyFramer::SpdyFramerError err) { | 416 Error MapFramerErrorToNetError(SpdyFramer::SpdyFramerError err) { |
| 416 switch (err) { | 417 switch (err) { |
| 417 case SpdyFramer::SPDY_NO_ERROR: | 418 case SpdyFramer::SPDY_NO_ERROR: |
| 418 return OK; | 419 return OK; |
| 419 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME: | 420 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME: |
| 420 return ERR_SPDY_PROTOCOL_ERROR; | 421 return ERR_SPDY_PROTOCOL_ERROR; |
| 421 case SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE: | 422 case SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE: |
| 422 return ERR_SPDY_FRAME_SIZE_ERROR; | 423 return ERR_SPDY_FRAME_SIZE_ERROR; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 439 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS: | 440 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS: |
| 440 return ERR_SPDY_PROTOCOL_ERROR; | 441 return ERR_SPDY_PROTOCOL_ERROR; |
| 441 case SpdyFramer::SPDY_UNEXPECTED_FRAME: | 442 case SpdyFramer::SPDY_UNEXPECTED_FRAME: |
| 442 return ERR_SPDY_PROTOCOL_ERROR; | 443 return ERR_SPDY_PROTOCOL_ERROR; |
| 443 case SpdyFramer::SPDY_INTERNAL_FRAMER_ERROR: | 444 case SpdyFramer::SPDY_INTERNAL_FRAMER_ERROR: |
| 444 return ERR_SPDY_PROTOCOL_ERROR; | 445 return ERR_SPDY_PROTOCOL_ERROR; |
| 445 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE: | 446 case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE: |
| 446 return ERR_SPDY_FRAME_SIZE_ERROR; | 447 return ERR_SPDY_FRAME_SIZE_ERROR; |
| 447 case SpdyFramer::SPDY_INVALID_STREAM_ID: | 448 case SpdyFramer::SPDY_INVALID_STREAM_ID: |
| 448 return ERR_SPDY_PROTOCOL_ERROR; | 449 return ERR_SPDY_PROTOCOL_ERROR; |
| 449 default: | 450 case SpdyFramer::SPDY_OVERSIZED_PAYLOAD: |
| 451 return ERR_SPDY_FRAME_SIZE_ERROR; |
| 452 case SpdyFramer::LAST_ERROR: |
| 450 NOTREACHED(); | 453 NOTREACHED(); |
| 451 return ERR_SPDY_PROTOCOL_ERROR; | |
| 452 } | 454 } |
| 455 NOTREACHED(); |
| 456 return ERR_SPDY_PROTOCOL_ERROR; |
| 453 } | 457 } |
| 454 | 458 |
| 455 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( | 459 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( |
| 456 SpdyErrorCode error_code) { | 460 SpdyErrorCode error_code) { |
| 457 switch (error_code) { | 461 switch (error_code) { |
| 458 case ERROR_CODE_NO_ERROR: | 462 case ERROR_CODE_NO_ERROR: |
| 459 return STATUS_CODE_NO_ERROR; | 463 return STATUS_CODE_NO_ERROR; |
| 460 case ERROR_CODE_PROTOCOL_ERROR: | 464 case ERROR_CODE_PROTOCOL_ERROR: |
| 461 return STATUS_CODE_PROTOCOL_ERROR; | 465 return STATUS_CODE_PROTOCOL_ERROR; |
| 462 case ERROR_CODE_INTERNAL_ERROR: | 466 case ERROR_CODE_INTERNAL_ERROR: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 476 case ERROR_CODE_COMPRESSION_ERROR: | 480 case ERROR_CODE_COMPRESSION_ERROR: |
| 477 return STATUS_CODE_COMPRESSION_ERROR; | 481 return STATUS_CODE_COMPRESSION_ERROR; |
| 478 case ERROR_CODE_CONNECT_ERROR: | 482 case ERROR_CODE_CONNECT_ERROR: |
| 479 return STATUS_CODE_CONNECT_ERROR; | 483 return STATUS_CODE_CONNECT_ERROR; |
| 480 case ERROR_CODE_ENHANCE_YOUR_CALM: | 484 case ERROR_CODE_ENHANCE_YOUR_CALM: |
| 481 return STATUS_CODE_ENHANCE_YOUR_CALM; | 485 return STATUS_CODE_ENHANCE_YOUR_CALM; |
| 482 case ERROR_CODE_INADEQUATE_SECURITY: | 486 case ERROR_CODE_INADEQUATE_SECURITY: |
| 483 return STATUS_CODE_INADEQUATE_SECURITY; | 487 return STATUS_CODE_INADEQUATE_SECURITY; |
| 484 case ERROR_CODE_HTTP_1_1_REQUIRED: | 488 case ERROR_CODE_HTTP_1_1_REQUIRED: |
| 485 return STATUS_CODE_HTTP_1_1_REQUIRED; | 489 return STATUS_CODE_HTTP_1_1_REQUIRED; |
| 486 default: | |
| 487 NOTREACHED(); | |
| 488 return static_cast<SpdyProtocolErrorDetails>(-1); | |
| 489 } | 490 } |
| 491 NOTREACHED(); |
| 492 return static_cast<SpdyProtocolErrorDetails>(-1); |
| 490 } | 493 } |
| 491 | 494 |
| 492 SpdyErrorCode MapNetErrorToGoAwayStatus(Error err) { | 495 SpdyErrorCode MapNetErrorToGoAwayStatus(Error err) { |
| 493 switch (err) { | 496 switch (err) { |
| 494 case OK: | 497 case OK: |
| 495 return ERROR_CODE_NO_ERROR; | 498 return ERROR_CODE_NO_ERROR; |
| 496 case ERR_SPDY_PROTOCOL_ERROR: | 499 case ERR_SPDY_PROTOCOL_ERROR: |
| 497 return ERROR_CODE_PROTOCOL_ERROR; | 500 return ERROR_CODE_PROTOCOL_ERROR; |
| 498 case ERR_SPDY_FLOW_CONTROL_ERROR: | 501 case ERR_SPDY_FLOW_CONTROL_ERROR: |
| 499 return ERROR_CODE_FLOW_CONTROL_ERROR; | 502 return ERROR_CODE_FLOW_CONTROL_ERROR; |
| (...skipping 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3117 if (!queue->empty()) { | 3120 if (!queue->empty()) { |
| 3118 SpdyStreamId stream_id = queue->front(); | 3121 SpdyStreamId stream_id = queue->front(); |
| 3119 queue->pop_front(); | 3122 queue->pop_front(); |
| 3120 return stream_id; | 3123 return stream_id; |
| 3121 } | 3124 } |
| 3122 } | 3125 } |
| 3123 return 0; | 3126 return 0; |
| 3124 } | 3127 } |
| 3125 | 3128 |
| 3126 } // namespace net | 3129 } // namespace net |
| OLD | NEW |