refactor: Replace HTTPServer::MaybeDispatchRequestsFromClient() with HTTPRemoteClient::TryReadRequest()

This commit is contained in:
Hodlinator
2026-08-25 13:21:43 +02:00
parent a1183c02aa
commit 5b06d90831
2 changed files with 20 additions and 17 deletions

View File

@@ -464,16 +464,6 @@ private:
*/
void ThreadSocketHandler() EXCLUSIVE_LOCKS_REQUIRED(!m_request_dispatcher_mutex);
/**
* Try to read HTTPRequests from a client's receive buffer.
* Complete requests are dispatched, incomplete requests are
* left in the buffer to wait for more data. Some read errors
* will mark this client for disconnection.
* @param[in] client The HTTPRemoteClient to read requests from
*/
void MaybeDispatchRequestsFromClient(const std::shared_ptr<HTTPRemoteClient>& client) const
EXCLUSIVE_LOCKS_REQUIRED(!m_request_dispatcher_mutex);
/**
* Close underlying socket connections for flagged clients
* by removing their shared pointer from m_connected. If an HTTPRemoteClient
@@ -585,6 +575,14 @@ public:
bool MaybeDisconnect(std::chrono::time_point<SteadyClock> now, std::chrono::seconds rpcservertimeout, bool disconnect_all);
/**
* Try to read an HTTPRequest from a client's receive buffer.
* Only complete requests are returned, incomplete requests are
* left in the buffer to wait for more data. Some read errors
* will mark this client for disconnection.
*/
static std::unique_ptr<HTTPRequest> TryReadRequest(const std::shared_ptr<HTTPRemoteClient>& client);
/**
* Try to read an HTTP request from the receive buffer.
* Updates HTTPRequest.m_state and drains buffer on error.