Commit a255e4ef authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Use same priority in frontend and backend HTTP2

parent 81cf4841
......@@ -525,11 +525,16 @@ evbuffer* Downstream::get_response_body_buf()
return response_body_buf_;
}
void Downstream::set_priority(int pri)
void Downstream::set_priority(int32_t pri)
{
priority_ = pri;
}
int32_t Downstream::get_priorty() const
{
return priority_;
}
void Downstream::check_upgrade_fulfilled()
{
if(request_method_ == "CONNECT") {
......
......@@ -54,7 +54,8 @@ public:
Upstream* get_upstream() const;
void set_stream_id(int32_t stream_id);
int32_t get_stream_id() const;
void set_priority(int pri);
void set_priority(int32_t pri);
int32_t get_priorty() const;
void pause_read(IOCtrlReason reason);
int resume_read(IOCtrlReason reason);
void force_resume_read();
......@@ -177,7 +178,7 @@ private:
Upstream *upstream_;
DownstreamConnection *dconn_;
int32_t stream_id_;
int priority_;
int32_t priority_;
// stream ID in backend connection
int32_t downstream_stream_id_;
// true if the request contains upgrade token (HTTP Upgrade or
......
......@@ -392,9 +392,11 @@ int Http2DownstreamConnection::push_request_headers()
nghttp2_data_provider data_prd;
data_prd.source.ptr = this;
data_prd.read_callback = http2_data_read_callback;
rv = http2session_->submit_request(this, 0, nv.data(), &data_prd);
rv = http2session_->submit_request(this, downstream_->get_priorty(),
nv.data(), &data_prd);
} else {
rv = http2session_->submit_request(this, 0, nv.data(), nullptr);
rv = http2session_->submit_request(this, downstream_->get_priorty(),
nv.data(), nullptr);
}
if(rv != 0) {
DCLOG(FATAL, this) << "nghttp2_submit_request() failed";
......
......@@ -76,7 +76,7 @@ int htp_msg_begin(http_parser *htp)
ULOG(INFO, upstream) << "HTTP request started";
}
upstream->reset_current_header_length();
auto downstream = new Downstream(upstream, 0, 0);
auto downstream = new Downstream(upstream, 0, NGHTTP2_PRI_DEFAULT);
upstream->attach_downstream(downstream);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment