Skip to content

Commit bb4839a

Browse files
committed
Using asio::ip::address_v6::any() for empty listen interface.
1 parent 4d90a97 commit bb4839a

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

source/relay/sessions_worker.cc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,23 @@ void SessionsWorker::onBeforeThreadRunning()
7878
self_task_runner_ = thread_->taskRunner();
7979
DCHECK(self_task_runner_);
8080

81-
std::error_code error_code;
82-
asio::ip::address listen_address =
83-
asio::ip::make_address(base::local8BitFromUtf16(listen_interface_), error_code);
84-
if (error_code)
81+
asio::ip::address listen_address;
82+
83+
if (!listen_interface_.empty())
8584
{
86-
LOG(LS_ERROR) << "Unable to get listen address: "
87-
<< base::utf16FromLocal8Bit(error_code.message());
88-
return;
85+
std::error_code error_code;
86+
listen_address = asio::ip::make_address(
87+
base::local8BitFromUtf16(listen_interface_), error_code);
88+
if (error_code)
89+
{
90+
LOG(LS_ERROR) << "Unable to get listen address: "
91+
<< base::utf16FromLocal8Bit(error_code.message());
92+
return;
93+
}
94+
}
95+
else
96+
{
97+
listen_address = asio::ip::address_v6::any();
8998
}
9099

91100
session_manager_ = std::make_unique<SessionManager>(

0 commit comments

Comments
 (0)