nghttpx: Use int for resonse_rst_stream_error_code_

This commit is contained in:
Tatsuhiro Tsujikawa 2014-08-17 16:36:02 +09:00
parent 5d2390deba
commit 49a9ec2cb3
4 changed files with 9 additions and 11 deletions

View File

@ -55,7 +55,7 @@ Downstream::Downstream(Upstream *upstream, int stream_id, int priority)
stream_id_(stream_id), stream_id_(stream_id),
priority_(priority), priority_(priority),
downstream_stream_id_(-1), downstream_stream_id_(-1),
response_rst_stream_error_code_(NGHTTP2_NO_ERROR), response_rst_stream_error_code_(-1),
request_state_(INITIAL), request_state_(INITIAL),
request_major_(1), request_major_(1),
request_minor_(1), request_minor_(1),
@ -821,13 +821,12 @@ int32_t Downstream::get_downstream_stream_id() const
return downstream_stream_id_; return downstream_stream_id_;
} }
nghttp2_error_code Downstream::get_response_rst_stream_error_code() const int Downstream::get_response_rst_stream_error_code() const
{ {
return response_rst_stream_error_code_; return response_rst_stream_error_code_;
} }
void Downstream::set_response_rst_stream_error_code void Downstream::set_response_rst_stream_error_code(int error_code)
(nghttp2_error_code error_code)
{ {
response_rst_stream_error_code_ = error_code; response_rst_stream_error_code_ = error_code;
} }

View File

@ -206,8 +206,8 @@ public:
evbuffer* get_response_body_buf(); evbuffer* get_response_body_buf();
void add_response_bodylen(size_t amount); void add_response_bodylen(size_t amount);
int64_t get_response_bodylen() const; int64_t get_response_bodylen() const;
nghttp2_error_code get_response_rst_stream_error_code() const; int get_response_rst_stream_error_code() const;
void set_response_rst_stream_error_code(nghttp2_error_code error_code); void set_response_rst_stream_error_code(int error_code);
// Inspects HTTP/1 response. This checks tranfer-encoding etc. // Inspects HTTP/1 response. This checks tranfer-encoding etc.
void inspect_http1_response(); void inspect_http1_response();
// Clears some of member variables for response. // Clears some of member variables for response.
@ -301,7 +301,7 @@ private:
int32_t downstream_stream_id_; int32_t downstream_stream_id_;
// RST_STREAM error_code from downstream HTTP2 connection // RST_STREAM error_code from downstream HTTP2 connection
nghttp2_error_code response_rst_stream_error_code_; int response_rst_stream_error_code_;
int request_state_; int request_state_;
int request_major_; int request_major_;

View File

@ -626,14 +626,14 @@ int on_unknown_frame_recv_callback(nghttp2_session *session,
namespace { namespace {
nghttp2_error_code infer_upstream_rst_stream_error_code nghttp2_error_code infer_upstream_rst_stream_error_code
(nghttp2_error_code downstream_error_code) (int downstream_error_code)
{ {
// NGHTTP2_REFUSED_STREAM is important because it tells upstream // NGHTTP2_REFUSED_STREAM is important because it tells upstream
// client to retry. // client to retry.
switch(downstream_error_code) { switch(downstream_error_code) {
case NGHTTP2_NO_ERROR: case NGHTTP2_NO_ERROR:
case NGHTTP2_REFUSED_STREAM: case NGHTTP2_REFUSED_STREAM:
return downstream_error_code; return static_cast<nghttp2_error_code>(downstream_error_code);
default: default:
return NGHTTP2_INTERNAL_ERROR; return NGHTTP2_INTERNAL_ERROR;
} }

View File

@ -411,8 +411,7 @@ void on_unknown_ctrl_recv_callback(spdylay_session *session,
namespace { namespace {
// Infer upstream RST_STREAM status code from downstream HTTP/2 // Infer upstream RST_STREAM status code from downstream HTTP/2
// error code. // error code.
uint32_t infer_upstream_rst_stream_status_code uint32_t infer_upstream_rst_stream_status_code(int downstream_error_code)
(nghttp2_error_code downstream_error_code)
{ {
// Only propagate *_REFUSED_STREAM so that upstream client can // Only propagate *_REFUSED_STREAM so that upstream client can
// resend request. // resend request.