mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-28 09:47:09 +02:00
Fix Windows compile error
This commit is contained in:
parent
a407e68df6
commit
29e267532a
2 changed files with 11 additions and 5 deletions
|
@ -399,6 +399,9 @@ ClientConnectionWs::~ClientConnectionWs()
|
|||
|
||||
tcp_websocket& ClientConnectionWs::getWs()
|
||||
{
|
||||
// Looks like the websocket must be recreated after disconnect:
|
||||
// https://github.com/boostorg/beast/issues/2409#issuecomment-1103685782
|
||||
|
||||
std::lock_guard lock(ws_mutex_);
|
||||
if (tcp_ws_.has_value())
|
||||
return tcp_ws_.value();
|
||||
|
@ -524,6 +527,9 @@ ClientConnectionWss::ClientConnectionWss(boost::asio::io_context& io_context, bo
|
|||
|
||||
ssl_websocket& ClientConnectionWss::getWs()
|
||||
{
|
||||
// Looks like the websocket must be recreated after disconnect:
|
||||
// https://github.com/boostorg/beast/issues/2409#issuecomment-1103685782
|
||||
|
||||
std::lock_guard lock(ws_mutex_);
|
||||
if (ssl_ws_.has_value())
|
||||
return ssl_ws_.value();
|
||||
|
@ -586,7 +592,7 @@ std::string ClientConnectionWss::getMacAddress()
|
|||
#ifndef WINDOWS
|
||||
::getMacAddress(getWs().next_layer().lowest_layer().native_handle());
|
||||
#else
|
||||
::getMacAddress(ssl_ws_.next_layer().lowest_layer().local_endpoint().address().to_string());
|
||||
::getMacAddress(getWs().next_layer().lowest_layer().local_endpoint().address().to_string());
|
||||
#endif
|
||||
if (mac.empty())
|
||||
mac = "00:00:00:00:00:00";
|
||||
|
@ -641,12 +647,12 @@ boost::system::error_code ClientConnectionWss::doConnect(boost::asio::ip::basic_
|
|||
{
|
||||
boost::system::error_code ec;
|
||||
getWs().binary(true);
|
||||
beast::get_lowest_layer(*ssl_ws_).connect(endpoint, ec);
|
||||
beast::get_lowest_layer(getWs()).connect(endpoint, ec);
|
||||
if (ec.failed())
|
||||
return ec;
|
||||
|
||||
// Set a timeout on the operation
|
||||
// beast::get_lowest_layer(ssl_ws_).expires_after(std::chrono::seconds(30));
|
||||
// beast::get_lowest_layer(getWs()).expires_after(std::chrono::seconds(30));
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
getWs().set_option(websocket::stream_base::timeout::suggested(beast::role_type::client));
|
||||
|
|
|
@ -88,9 +88,9 @@ Controller::Controller(boost::asio::io_context& io_context, const ClientSettings
|
|||
LOG(WARNING, LOG_TAG) << "Failed to load system certificates: " << ec << "\n";
|
||||
if (!settings.server.certificate->empty())
|
||||
{
|
||||
ssl_context_.load_verify_file(settings.server.certificate.value(), ec);
|
||||
ssl_context_.load_verify_file(settings.server.certificate.value().string(), ec);
|
||||
if (ec.failed())
|
||||
throw SnapException("Failed to load certificate: " + settings.server.certificate.value().native() + ": " + ec.message());
|
||||
throw SnapException("Failed to load certificate: " + settings.server.certificate.value().string() + ": " + ec.message());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue