Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] fix connection reuse #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/resty/http2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/resty/http2/protocol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down