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

长连接时后续请求会被忽略 #49

Open
zhangzy7 opened this issue Nov 25, 2021 · 1 comment
Open

长连接时后续请求会被忽略 #49

zhangzy7 opened this issue Nov 25, 2021 · 1 comment

Comments

@zhangzy7
Copy link

我在使用 jmeter 多线程测试多个接口时,发现如果都勾选了 keep-alive,每个线程第一个请求之后的请求都会失败。
我看到 JQHttpServer::Session 里有个 30秒 的计时器,推测这个库应该有支持 Http/1.1 的长连接功能。
检查了下代码,发现是由于在 JQHttpServer::Session::onBytesWritten 函数里,大约第826行,调用了 socket_->disconnectFromHost() 关掉了该连接,导致后续请求都不会被接收。
建议 session 增加一个 reset 函数,在一个请求结束后(比如 第826行 的 回复完成后),将 session 的解析参数重置为默认值,以继续解析后续请求。

@188080501
Copy link
Owner

目前库的设计没有考虑长连接,在一次reply后会释放连接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants