Skip to content

Commit

Permalink
Using asio::ip::address_v6::any() for empty listen interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchapyshev committed Nov 11, 2023
1 parent 4d90a97 commit bb4839a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions source/relay/sessions_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<SessionManager>(
Expand Down

0 comments on commit bb4839a

Please sign in to comment.