Start ApiListener#SyncClient() in the thread pool

... not hosting the coroutines not to block them.

Otherwise a large replay log would block messages sending
until the peer disconnects us.
This commit is contained in:
Alexander A. Klimov 2020-11-12 13:46:47 +01:00
parent 3dcc6c32f3
commit 1343fd538d
1 changed files with 1 additions and 4 deletions

View File

@ -691,12 +691,9 @@ void ApiListener::NewClientHandlerInternal(
if (endpoint) {
endpoint->AddClient(aclient);
IoEngine::SpawnCoroutine(IoEngine::Get().GetIoContext(), [this, aclient, endpoint](asio::yield_context yc) {
CpuBoundWork syncClient (yc);
Utility::QueueAsyncCallback([this, aclient, endpoint]() {
SyncClient(aclient, endpoint, true);
});
} else if (!AddAnonymousClient(aclient)) {
Log(LogNotice, "ApiListener")
<< "Ignoring anonymous JSON-RPC connection " << conninfo