updated build system
All checks were successful
Public/monitarr/pipeline/head This commit looks good
All checks were successful
Public/monitarr/pipeline/head This commit looks good
This commit is contained in:
parent
0b54135f59
commit
2fcb9490c9
@ -15,6 +15,7 @@ if [ "${PROJECT_IS_MINGW}" == "1" ] && [ "${PROJECT_STATIC_LINK}" == "OFF" ]; th
|
||||
/mingw64/bin/libstdc++-6.dll
|
||||
/mingw64/bin/libwinpthread-1.dll
|
||||
/mingw64/bin/libzlib1.dll
|
||||
/mingw64/bin/libzstd.dll
|
||||
/mingw64/bin/zlib1.dll
|
||||
)
|
||||
|
||||
|
@ -131,23 +131,46 @@ auto get_next_available_port(std::uint16_t first_port,
|
||||
using ip::tcp;
|
||||
|
||||
boost::system::error_code error_code{};
|
||||
while (first_port != 0U) {
|
||||
|
||||
std::uint32_t check_port{first_port};
|
||||
while (check_port <= 65535U) {
|
||||
{
|
||||
io_context ctx{};
|
||||
tcp::socket socket(ctx);
|
||||
socket.connect(
|
||||
{
|
||||
tcp::endpoint(ip::address_v4::loopback(),
|
||||
static_cast<std::uint16_t>(check_port)),
|
||||
},
|
||||
error_code);
|
||||
if (not error_code) {
|
||||
++check_port;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
io_context ctx{};
|
||||
tcp::acceptor acceptor(ctx);
|
||||
acceptor.open(tcp::v4(), error_code) ||
|
||||
acceptor.bind({tcp::v4(), first_port}, error_code);
|
||||
if (not error_code) {
|
||||
break;
|
||||
acceptor.open(tcp::v4(), error_code);
|
||||
if (error_code) {
|
||||
++check_port;
|
||||
continue;
|
||||
}
|
||||
|
||||
++first_port;
|
||||
acceptor.bind({tcp::v4(), static_cast<std::uint16_t>(check_port)},
|
||||
error_code);
|
||||
if (error_code) {
|
||||
++check_port;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (not error_code) {
|
||||
available_port = first_port;
|
||||
available_port = static_cast<std::uint16_t>(check_port);
|
||||
return true;
|
||||
}
|
||||
|
||||
return not error_code;
|
||||
return false;
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_BOOST)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user