v1.1.0-release #1

Merged
sgraves merged 8 commits from v1.1.0-rc-develop into main 2025-04-13 11:49:17 -05:00
2 changed files with 37 additions and 13 deletions
Showing only changes of commit 2fcb9490c9 - Show all commits

View File

@@ -15,6 +15,7 @@ if [ "${PROJECT_IS_MINGW}" == "1" ] && [ "${PROJECT_STATIC_LINK}" == "OFF" ]; th
/mingw64/bin/libstdc++-6.dll /mingw64/bin/libstdc++-6.dll
/mingw64/bin/libwinpthread-1.dll /mingw64/bin/libwinpthread-1.dll
/mingw64/bin/libzlib1.dll /mingw64/bin/libzlib1.dll
/mingw64/bin/libzstd.dll
/mingw64/bin/zlib1.dll /mingw64/bin/zlib1.dll
) )

View File

@@ -131,23 +131,46 @@ auto get_next_available_port(std::uint16_t first_port,
using ip::tcp; using ip::tcp;
boost::system::error_code error_code{}; boost::system::error_code error_code{};
while (first_port != 0U) {
io_context ctx{}; std::uint32_t check_port{first_port};
tcp::acceptor acceptor(ctx); while (check_port <= 65535U) {
acceptor.open(tcp::v4(), error_code) || {
acceptor.bind({tcp::v4(), first_port}, error_code); io_context ctx{};
if (not error_code) { tcp::socket socket(ctx);
break; socket.connect(
{
tcp::endpoint(ip::address_v4::loopback(),
static_cast<std::uint16_t>(check_port)),
},
error_code);
if (not error_code) {
++check_port;
continue;
}
} }
++first_port; {
io_context ctx{};
tcp::acceptor acceptor(ctx);
acceptor.open(tcp::v4(), error_code);
if (error_code) {
++check_port;
continue;
}
acceptor.bind({tcp::v4(), static_cast<std::uint16_t>(check_port)},
error_code);
if (error_code) {
++check_port;
continue;
}
}
available_port = static_cast<std::uint16_t>(check_port);
return true;
} }
if (not error_code) { return false;
available_port = first_port;
}
return not error_code;
} }
#endif // defined(PROJECT_ENABLE_BOOST) #endif // defined(PROJECT_ENABLE_BOOST)