diff --git a/lib/resty/http2.lua b/lib/resty/http2.lua index 3e4ed22..0087b77 100644 --- a/lib/resty/http2.lua +++ b/lib/resty/http2.lua @@ -169,15 +169,16 @@ function _M.new(opts) local session local err local ok + local reuse_cnt + reuse_cnt, err = ctx:getreusedtimes() - if key and session_pool[key] then + if key and session_pool[key] and reuse_cnt ~= nil and reuse_cnt ~= 0 then session = session_pool[key] session_pool[key] = nil ok, err = session:attach(recv, send, ctx) if not ok then return nil, err end - else session, err = h2_protocol.session(recv, send, ctx, preread_size, max_concurrent_stream, diff --git a/lib/resty/http2/protocol.lua b/lib/resty/http2/protocol.lua index c633c4e..e6bcd7d 100644 --- a/lib/resty/http2/protocol.lua +++ b/lib/resty/http2/protocol.lua @@ -243,7 +243,7 @@ function _M:submit_request(headers, no_body, priority, pad) local total = self.total_streams if total == self.max_streams then - return nil, h2_error.STRERAM_OVERFLOW + return nil, h2_error.STREAM_FLOW_CONTROL_ERROR end if self.goaway_sent or self.goaway_received then