From 204b3884d1fca9b14cfa734484fb62b84b69314c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 16 Aug 2021 22:49:00 +0900 Subject: [PATCH] nghttpx: Extend Downstream stream_id to 64 bits --- src/shrpx_downstream.cc | 14 +++++++------- src/shrpx_downstream.h | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc index dc7762d0..d3d40e51 100644 --- a/src/shrpx_downstream.cc +++ b/src/shrpx_downstream.cc @@ -113,7 +113,7 @@ void downstream_wtimeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { // upstream could be nullptr for unittests Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool, - int32_t stream_id) + int64_t stream_id) : dlnext(nullptr), dlprev(nullptr), response_sent_body_length(0), @@ -605,9 +605,9 @@ void Downstream::reset_upstream(Upstream *upstream) { Upstream *Downstream::get_upstream() const { return upstream_; } -void Downstream::set_stream_id(int32_t stream_id) { stream_id_ = stream_id; } +void Downstream::set_stream_id(int64_t stream_id) { stream_id_ = stream_id; } -int32_t Downstream::get_stream_id() const { return stream_id_; } +int64_t Downstream::get_stream_id() const { return stream_id_; } void Downstream::set_request_state(DownstreamState state) { request_state_ = state; @@ -904,11 +904,11 @@ StringRef Downstream::get_http2_settings() const { return http2_settings->value; } -void Downstream::set_downstream_stream_id(int32_t stream_id) { +void Downstream::set_downstream_stream_id(int64_t stream_id) { downstream_stream_id_ = stream_id; } -int32_t Downstream::get_downstream_stream_id() const { +int64_t Downstream::get_downstream_stream_id() const { return downstream_stream_id_; } @@ -1115,11 +1115,11 @@ DefaultMemchunks Downstream::pop_response_buf() { return std::move(response_buf_); } -void Downstream::set_assoc_stream_id(int32_t stream_id) { +void Downstream::set_assoc_stream_id(int64_t stream_id) { assoc_stream_id_ = stream_id; } -int32_t Downstream::get_assoc_stream_id() const { return assoc_stream_id_; } +int64_t Downstream::get_assoc_stream_id() const { return assoc_stream_id_; } BlockAllocator &Downstream::get_block_allocator() { return balloc_; } diff --git a/src/shrpx_downstream.h b/src/shrpx_downstream.h index fff49a1a..10063b50 100644 --- a/src/shrpx_downstream.h +++ b/src/shrpx_downstream.h @@ -319,20 +319,20 @@ enum class DispatchState { class Downstream { public: - Downstream(Upstream *upstream, MemchunkPool *mcpool, int32_t stream_id); + Downstream(Upstream *upstream, MemchunkPool *mcpool, int64_t stream_id); ~Downstream(); void reset_upstream(Upstream *upstream); Upstream *get_upstream() const; - void set_stream_id(int32_t stream_id); - int32_t get_stream_id() const; - void set_assoc_stream_id(int32_t stream_id); - int32_t get_assoc_stream_id() const; + void set_stream_id(int64_t stream_id); + int64_t get_stream_id() const; + void set_assoc_stream_id(int64_t stream_id); + int64_t get_assoc_stream_id() const; void pause_read(IOCtrlReason reason); int resume_read(IOCtrlReason reason, size_t consumed); void force_resume_read(); // Set stream ID for downstream HTTP2 connection. - void set_downstream_stream_id(int32_t stream_id); - int32_t get_downstream_stream_id() const; + void set_downstream_stream_id(int64_t stream_id); + int64_t get_downstream_stream_id() const; int attach_downstream_connection(std::unique_ptr dconn); void detach_downstream_connection(); @@ -566,12 +566,12 @@ private: // How many times we tried in backend connection size_t num_retry_; // The stream ID in frontend connection - int32_t stream_id_; + int64_t stream_id_; // The associated stream ID in frontend connection if this is pushed // stream. - int32_t assoc_stream_id_; + int64_t assoc_stream_id_; // stream ID in backend connection - int32_t downstream_stream_id_; + int64_t downstream_stream_id_; // RST_STREAM error_code from downstream HTTP2 connection uint32_t response_rst_stream_error_code_; // An affinity cookie value.