278{
279 try {
280 auto command_copy {std::make_shared<std::string>(lr_ipc_out_shared->
command_.
pop())};
281 if (*command_copy == kTerminate) [[unlikely]] { return; }
282 if (command_copy->empty() || command_copy->back() != '\n') [[unlikely]] {
283 command_copy->push_back('\n');
284 }
285 asio::async_write(lr_ipc_out_shared->
socket_, asio::buffer(*command_copy),
286 [command_copy, lr_ipc_out_shared](const asio::error_code& error, std::size_t) mutable {
287
288 const auto alive {lr_ipc_out_shared->owner_alive_};
289 if (!alive || !alive->load(std::memory_order_acquire)) { return; }
290
291 if (!error) [[likely]] {
SendOut(std::move(lr_ipc_out_shared)); }
292 else {
293 rsj::Log(fmt::format(
"LR_IPC_Out Write: {}.", error.message()),
294 std::source_location::current());
295 }
296 });
297 }
298 catch (const std::exception& e) {
300 throw;
301 }
302}
rsj::ConcurrentQueue< std::string > command_
Definition LR_IPC_Out.cpp:47
static void SendOut(std::shared_ptr< LrIpcOutShared > lr_ipc_out_shared)
Definition LR_IPC_Out.cpp:277
T pop()
Definition Concurrency.h:190
void ExceptionResponse(gsl::czstring id, gsl::czstring fu, const std::exception &e) noexcept
void Log(const juce::String &info, const std::source_location &location=std::source_location::current()) noexcept
Definition Misc.cpp:112