Fix bug with buffered read

This commit is contained in:
alesapin 2020-11-26 15:26:41 +03:00
parent 0b079cdeb8
commit fc0bca1ff2

View File

@ -89,6 +89,7 @@ struct SocketInterruptablePollWrapper
#if defined(POCO_HAVE_FD_EPOLL) #if defined(POCO_HAVE_FD_EPOLL)
int rc; int rc;
epoll_event evout[2]; epoll_event evout[2];
memset(evout, 0, sizeof(evout));
do do
{ {
Poco::Timestamp start; Poco::Timestamp start;
@ -283,6 +284,8 @@ void TestKeeperTCPHandler::runImpl()
auto state = poll_wrapper->poll(session_timeout); auto state = poll_wrapper->poll(session_timeout);
if (state & SocketInterruptablePollWrapper::HAS_REQUEST) if (state & SocketInterruptablePollWrapper::HAS_REQUEST)
{
do
{ {
auto received_op = receiveRequest(); auto received_op = receiveRequest();
if (received_op == Coordination::OpNum::Close) if (received_op == Coordination::OpNum::Close)
@ -292,8 +295,10 @@ void TestKeeperTCPHandler::runImpl()
} }
else if (received_op == Coordination::OpNum::Heartbeat) else if (received_op == Coordination::OpNum::Heartbeat)
{ {
LOG_TRACE(log, "Received heartbeat for session #{}", session_id);
session_stopwatch.restart(); session_stopwatch.restart();
} }
} while (in->available());
} }
if (state & SocketInterruptablePollWrapper::HAS_RESPONSE) if (state & SocketInterruptablePollWrapper::HAS_RESPONSE)