Check socket is connected in HTTPSession (#36683)

This commit is contained in:
Nikita Mikhaylov 2022-04-28 15:12:25 +02:00 committed by GitHub
parent ca519ca75e
commit 7dc084419e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,12 +22,12 @@ void HTTPServerConnection::run()
std::string server = params->getSoftwareVersion();
Poco::Net::HTTPServerSession session(socket(), params);
while (!stopped && tcp_server.isOpen() && session.hasMoreRequests())
while (!stopped && tcp_server.isOpen() && session.hasMoreRequests() && session.connected())
{
try
{
std::unique_lock<std::mutex> lock(mutex);
if (!stopped && tcp_server.isOpen())
if (!stopped && tcp_server.isOpen() && session.connected())
{
HTTPServerResponse response(session);
HTTPServerRequest request(context, response, session);