From 49a9ec2cb3104fd9c2afcdf6ee4b9fd0d0bc3f33 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 17 Aug 2014 16:36:02 +0900 Subject: [PATCH] nghttpx: Use int for resonse_rst_stream_error_code_ --- src/shrpx_downstream.cc | 7 +++---- src/shrpx_downstream.h | 6 +++--- src/shrpx_http2_upstream.cc | 4 ++-- src/shrpx_spdy_upstream.cc | 3 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc index 2c983819..1fb46a0f 100644 --- a/src/shrpx_downstream.cc +++ b/src/shrpx_downstream.cc @@ -55,7 +55,7 @@ Downstream::Downstream(Upstream *upstream, int stream_id, int priority) stream_id_(stream_id), priority_(priority), downstream_stream_id_(-1), - response_rst_stream_error_code_(NGHTTP2_NO_ERROR), + response_rst_stream_error_code_(-1), request_state_(INITIAL), request_major_(1), request_minor_(1), @@ -821,13 +821,12 @@ int32_t Downstream::get_downstream_stream_id() const 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_; } -void Downstream::set_response_rst_stream_error_code -(nghttp2_error_code error_code) +void Downstream::set_response_rst_stream_error_code(int error_code) { response_rst_stream_error_code_ = error_code; } diff --git a/src/shrpx_downstream.h b/src/shrpx_downstream.h index 490aa2e5..90a4b8bb 100644 --- a/src/shrpx_downstream.h +++ b/src/shrpx_downstream.h @@ -206,8 +206,8 @@ public: evbuffer* get_response_body_buf(); void add_response_bodylen(size_t amount); int64_t get_response_bodylen() const; - nghttp2_error_code get_response_rst_stream_error_code() const; - void set_response_rst_stream_error_code(nghttp2_error_code error_code); + int get_response_rst_stream_error_code() const; + void set_response_rst_stream_error_code(int error_code); // Inspects HTTP/1 response. This checks tranfer-encoding etc. void inspect_http1_response(); // Clears some of member variables for response. @@ -301,7 +301,7 @@ private: int32_t downstream_stream_id_; // 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_major_; diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index 72fa85dd..fcd15108 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -626,14 +626,14 @@ int on_unknown_frame_recv_callback(nghttp2_session *session, namespace { 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 // client to retry. switch(downstream_error_code) { case NGHTTP2_NO_ERROR: case NGHTTP2_REFUSED_STREAM: - return downstream_error_code; + return static_cast(downstream_error_code); default: return NGHTTP2_INTERNAL_ERROR; } diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index b2bc1033..f5e35ef3 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -411,8 +411,7 @@ void on_unknown_ctrl_recv_callback(spdylay_session *session, namespace { // Infer upstream RST_STREAM status code from downstream HTTP/2 // error code. -uint32_t infer_upstream_rst_stream_status_code -(nghttp2_error_code downstream_error_code) +uint32_t infer_upstream_rst_stream_status_code(int downstream_error_code) { // Only propagate *_REFUSED_STREAM so that upstream client can // resend request.