From bb4839a7206146399eca6fb57574bb07192dd9f9 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sat, 11 Nov 2023 22:19:00 +0500 Subject: [PATCH] Using asio::ip::address_v6::any() for empty listen interface. --- source/relay/sessions_worker.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/source/relay/sessions_worker.cc b/source/relay/sessions_worker.cc index 3588fee413..07ff5a4688 100644 --- a/source/relay/sessions_worker.cc +++ b/source/relay/sessions_worker.cc @@ -78,14 +78,23 @@ void SessionsWorker::onBeforeThreadRunning() self_task_runner_ = thread_->taskRunner(); DCHECK(self_task_runner_); - std::error_code error_code; - asio::ip::address listen_address = - asio::ip::make_address(base::local8BitFromUtf16(listen_interface_), error_code); - if (error_code) + asio::ip::address listen_address; + + if (!listen_interface_.empty()) { - LOG(LS_ERROR) << "Unable to get listen address: " - << base::utf16FromLocal8Bit(error_code.message()); - return; + std::error_code error_code; + listen_address = asio::ip::make_address( + base::local8BitFromUtf16(listen_interface_), error_code); + if (error_code) + { + LOG(LS_ERROR) << "Unable to get listen address: " + << base::utf16FromLocal8Bit(error_code.message()); + return; + } + } + else + { + listen_address = asio::ip::address_v6::any(); } session_manager_ = std::make_unique(