diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenhttp/servers/httpasio.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/zenhttp/servers/httpasio.cpp b/src/zenhttp/servers/httpasio.cpp index 6b45c259d..c75057733 100644 --- a/src/zenhttp/servers/httpasio.cpp +++ b/src/zenhttp/servers/httpasio.cpp @@ -293,7 +293,7 @@ HttpServerConnection::TerminateConnection() void HttpServerConnection::EnqueueRead() { - if (m_RequestState == RequestState::kInitialRead) + if ((m_RequestState == RequestState::kInitialRead) || (m_RequestState == RequestState::kReadingMore)) { m_RequestState = RequestState::kReadingMore; } @@ -315,15 +315,17 @@ HttpServerConnection::OnDataReceived(const asio::error_code& Ec, [[maybe_unused] { if (Ec) { - if (m_RequestState == RequestState::kDone || m_RequestState == RequestState::kInitialRead) + switch (m_RequestState) { - ZEN_TRACE_VERBOSE("on data received ERROR (EXPECTED), connection: {}, reason: '{}'", m_ConnectionId, Ec.message()); - return; - } - else - { - ZEN_WARN("on data received ERROR, connection: {}, reason '{}'", m_ConnectionId, Ec.message()); - return TerminateConnection(); + case RequestState::kDone: + case RequestState::kInitialRead: + case RequestState::kTerminated: + ZEN_TRACE_VERBOSE("on data received ERROR (EXPECTED), connection: {}, reason: '{}'", m_ConnectionId, Ec.message()); + return; + + default: + ZEN_WARN("on data received ERROR, connection: {}, reason '{}'", m_ConnectionId, Ec.message()); + return TerminateConnection(); } } |