/v1/events: don't deadlock other coroutines

This commit is contained in:
Alexander A. Klimov 2019-04-05 09:22:42 +02:00
parent 2e5af2922b
commit 2e4e2e1a79
1 changed files with 3 additions and 0 deletions

View File

@ -101,6 +101,7 @@ bool EventsHandler::HandleRequest(
}
asio::const_buffer newLine ("\n", 1);
AsioConditionVariable dontLockOwnStrand (stream.get_io_service(), true);
for (;;) {
auto event (queue->WaitForEvent(&request, yc));
@ -119,6 +120,8 @@ bool EventsHandler::HandleRequest(
stream.async_flush(yc);
} else if (server.Disconnected()) {
return true;
} else {
dontLockOwnStrand.Wait(yc);
}
}
}