230{
231 try {
232 if (!lr_ipc_shared->thread_should_exit_.load(std::memory_order_acquire)) {
233 asio::async_read_until(lr_ipc_shared->socket_, lr_ipc_shared->streambuf_, '\n',
234 [lr_ipc_shared](const asio::error_code& error,
235 const std::size_t bytes_transferred) mutable {
236 if (!error) [[likely]] {
237 if (bytes_transferred == 0) [[unlikely]] { std::this_thread::sleep_for(kEmptyWait); }
238 else {
239 auto& buf {lr_ipc_shared->streambuf_};
240 std::string command {buffers_begin(buf.data()),
241 buffers_begin(buf.data()) + gsl::narrow<std::ptrdiff_t>(bytes_transferred)};
242 if (command == "TerminateApplication 1\n"s) {
243 lr_ipc_shared->thread_should_exit_.store(true, std::memory_order_release);
244 }
245 lr_ipc_shared->line_.push(std::move(command));
246 buf.consume(bytes_transferred);
247 }
248 Read(std::move(lr_ipc_shared));
249 }
250 else {
251 rsj::Log(fmt::format(FMT_STRING("LR_IPC_In Read error: {}."), error.message()));
252
253 if (error == asio::error::misc_errors::eof) {
254 juce::JUCEApplication::getInstance()->systemRequestedQuit();
255 }
256 }
257 });
258 }
259 }
260 catch (const std::exception& e) {
262 throw;
263 }
264}
void ExceptionResponse(gsl::czstring id, gsl::czstring fu, const std::exception &e) noexcept