mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Merge pull request #10278 from Icinga/boost187
Bump Boost shipped for Windows to v1.87
This commit is contained in:
commit
520aed6049
@ -13,7 +13,7 @@ function ThrowOnNativeFailure {
|
|||||||
|
|
||||||
$VsVersion = 2019
|
$VsVersion = 2019
|
||||||
$MsvcVersion = '14.2'
|
$MsvcVersion = '14.2'
|
||||||
$BoostVersion = @(1, 86, 0)
|
$BoostVersion = @(1, 87, 0)
|
||||||
$OpensslVersion = '3_0_15'
|
$OpensslVersion = '3_0_15'
|
||||||
|
|
||||||
switch ($Env:BITS) {
|
switch ($Env:BITS) {
|
||||||
|
@ -16,11 +16,16 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <boost/context/fixedsize_stack.hpp>
|
||||||
#include <boost/exception/all.hpp>
|
#include <boost/exception/all.hpp>
|
||||||
#include <boost/asio/deadline_timer.hpp>
|
#include <boost/asio/deadline_timer.hpp>
|
||||||
#include <boost/asio/io_context.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/spawn.hpp>
|
#include <boost/asio/spawn.hpp>
|
||||||
|
|
||||||
|
#if BOOST_VERSION >= 108700
|
||||||
|
# include <boost/asio/detached.hpp>
|
||||||
|
#endif // BOOST_VERSION >= 108700
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -100,24 +105,32 @@ public:
|
|||||||
|
|
||||||
template <typename Handler, typename Function>
|
template <typename Handler, typename Function>
|
||||||
static void SpawnCoroutine(Handler& h, Function f) {
|
static void SpawnCoroutine(Handler& h, Function f) {
|
||||||
|
auto wrapper = [f = std::move(f)](boost::asio::yield_context yc) {
|
||||||
boost::asio::spawn(h,
|
try {
|
||||||
[f](boost::asio::yield_context yc) {
|
f(yc);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
Log(LogCritical, "IoEngine") << "Exception in coroutine: " << DiagnosticInformation(ex);
|
||||||
|
} catch (...) {
|
||||||
try {
|
try {
|
||||||
f(yc);
|
|
||||||
} catch (const boost::coroutines::detail::forced_unwind &) {
|
|
||||||
// Required for proper stack unwinding when coroutines are destroyed.
|
|
||||||
// https://github.com/boostorg/coroutine/issues/39
|
|
||||||
throw;
|
|
||||||
} catch (const std::exception& ex) {
|
|
||||||
Log(LogCritical, "IoEngine") << "Exception in coroutine: " << DiagnosticInformation(ex);
|
|
||||||
} catch (...) {
|
|
||||||
Log(LogCritical, "IoEngine", "Exception in coroutine!");
|
Log(LogCritical, "IoEngine", "Exception in coroutine!");
|
||||||
|
} catch (...) {
|
||||||
}
|
}
|
||||||
},
|
|
||||||
boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size.
|
// Required for proper stack unwinding when coroutines are destroyed.
|
||||||
|
// https://github.com/boostorg/coroutine/issues/39
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#if BOOST_VERSION >= 108700
|
||||||
|
boost::asio::spawn(h,
|
||||||
|
std::allocator_arg, boost::context::fixedsize_stack(GetCoroutineStackSize()),
|
||||||
|
std::move(wrapper),
|
||||||
|
boost::asio::detached
|
||||||
);
|
);
|
||||||
|
#else // BOOST_VERSION >= 108700
|
||||||
|
boost::asio::spawn(h, std::move(wrapper), boost::coroutines::attributes(GetCoroutineStackSize()));
|
||||||
|
#endif // BOOST_VERSION >= 108700
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
|
@ -41,8 +41,7 @@ void Connect(Socket& socket, const String& node, const String& service)
|
|||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
tcp::resolver resolver (IoEngine::Get().GetIoContext());
|
tcp::resolver resolver (IoEngine::Get().GetIoContext());
|
||||||
tcp::resolver::query query (node, service);
|
auto result (resolver.resolve(node.GetData(), service.GetData()));
|
||||||
auto result (resolver.resolve(query));
|
|
||||||
auto current (result.begin());
|
auto current (result.begin());
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -72,8 +71,7 @@ void Connect(Socket& socket, const String& node, const String& service, boost::a
|
|||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
tcp::resolver resolver (IoEngine::Get().GetIoContext());
|
tcp::resolver resolver (IoEngine::Get().GetIoContext());
|
||||||
tcp::resolver::query query (node, service);
|
auto result (resolver.async_resolve(node.GetData(), service.GetData(), yc));
|
||||||
auto result (resolver.async_resolve(query, yc));
|
|
||||||
auto current (result.begin());
|
auto current (result.begin());
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -377,8 +377,6 @@ void RedisConnection::Connect(asio::yield_context& yc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
|
||||||
throw;
|
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogCritical, "IcingaDB")
|
Log(LogCritical, "IcingaDB")
|
||||||
<< "Cannot connect to " << m_Host << ":" << m_Port << ": " << ex.what();
|
<< "Cannot connect to " << m_Host << ":" << m_Port << ": " << ex.what();
|
||||||
@ -408,17 +406,10 @@ void RedisConnection::ReadLoop(asio::yield_context& yc)
|
|||||||
for (auto i (item.Amount); i; --i) {
|
for (auto i (item.Amount); i; --i) {
|
||||||
ReadOne(yc);
|
ReadOne(yc);
|
||||||
}
|
}
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
|
||||||
throw;
|
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogCritical, "IcingaDB")
|
Log(LogCritical, "IcingaDB")
|
||||||
<< "Error during receiving the response to a query which has been fired and forgotten: " << ex.what();
|
<< "Error during receiving the response to a query which has been fired and forgotten: " << ex.what();
|
||||||
|
|
||||||
continue;
|
|
||||||
} catch (...) {
|
|
||||||
Log(LogCritical, "IcingaDB")
|
|
||||||
<< "Error during receiving the response to a query which has been fired and forgotten";
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,9 +423,7 @@ void RedisConnection::ReadLoop(asio::yield_context& yc)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
reply = ReadOne(yc);
|
reply = ReadOne(yc);
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
} catch (const std::exception&) {
|
||||||
throw;
|
|
||||||
} catch (...) {
|
|
||||||
promise.set_exception(std::current_exception());
|
promise.set_exception(std::current_exception());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -455,9 +444,7 @@ void RedisConnection::ReadLoop(asio::yield_context& yc)
|
|||||||
for (auto i (item.Amount); i; --i) {
|
for (auto i (item.Amount); i; --i) {
|
||||||
try {
|
try {
|
||||||
replies.emplace_back(ReadOne(yc));
|
replies.emplace_back(ReadOne(yc));
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
} catch (const std::exception&) {
|
||||||
throw;
|
|
||||||
} catch (...) {
|
|
||||||
promise.set_exception(std::current_exception());
|
promise.set_exception(std::current_exception());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -551,19 +538,11 @@ void RedisConnection::WriteItem(boost::asio::yield_context& yc, RedisConnection:
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
WriteOne(item, yc);
|
WriteOne(item, yc);
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
|
||||||
throw;
|
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log msg (LogCritical, "IcingaDB", "Error during sending query");
|
Log msg (LogCritical, "IcingaDB", "Error during sending query");
|
||||||
LogQuery(item, msg);
|
LogQuery(item, msg);
|
||||||
msg << " which has been fired and forgotten: " << ex.what();
|
msg << " which has been fired and forgotten: " << ex.what();
|
||||||
|
|
||||||
return;
|
|
||||||
} catch (...) {
|
|
||||||
Log msg (LogCritical, "IcingaDB", "Error during sending query");
|
|
||||||
LogQuery(item, msg);
|
|
||||||
msg << " which has been fired and forgotten";
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,19 +566,11 @@ void RedisConnection::WriteItem(boost::asio::yield_context& yc, RedisConnection:
|
|||||||
WriteOne(query, yc);
|
WriteOne(query, yc);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
|
||||||
throw;
|
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log msg (LogCritical, "IcingaDB", "Error during sending query");
|
Log msg (LogCritical, "IcingaDB", "Error during sending query");
|
||||||
LogQuery(item[i], msg);
|
LogQuery(item[i], msg);
|
||||||
msg << " which has been fired and forgotten: " << ex.what();
|
msg << " which has been fired and forgotten: " << ex.what();
|
||||||
|
|
||||||
return;
|
|
||||||
} catch (...) {
|
|
||||||
Log msg (LogCritical, "IcingaDB", "Error during sending query");
|
|
||||||
LogQuery(item[i], msg);
|
|
||||||
msg << " which has been fired and forgotten";
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,9 +589,7 @@ void RedisConnection::WriteItem(boost::asio::yield_context& yc, RedisConnection:
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
WriteOne(item.first, yc);
|
WriteOne(item.first, yc);
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
} catch (const std::exception&) {
|
||||||
throw;
|
|
||||||
} catch (...) {
|
|
||||||
item.second.set_exception(std::current_exception());
|
item.second.set_exception(std::current_exception());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -645,9 +614,7 @@ void RedisConnection::WriteItem(boost::asio::yield_context& yc, RedisConnection:
|
|||||||
for (auto& query : item.first) {
|
for (auto& query : item.first) {
|
||||||
WriteOne(query, yc);
|
WriteOne(query, yc);
|
||||||
}
|
}
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
} catch (const std::exception&) {
|
||||||
throw;
|
|
||||||
} catch (...) {
|
|
||||||
item.second.set_exception(std::current_exception());
|
item.second.set_exception(std::current_exception());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -389,9 +389,7 @@ RedisConnection::Reply RedisConnection::ReadOne(StreamPtr& stream, boost::asio::
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return ReadRESP(*strm, yc);
|
return ReadRESP(*strm, yc);
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
} catch (const std::exception&) {
|
||||||
throw;
|
|
||||||
} catch (...) {
|
|
||||||
if (m_Connecting.exchange(false)) {
|
if (m_Connecting.exchange(false)) {
|
||||||
m_Connected.store(false);
|
m_Connected.store(false);
|
||||||
stream = nullptr;
|
stream = nullptr;
|
||||||
@ -427,9 +425,7 @@ void RedisConnection::WriteOne(StreamPtr& stream, RedisConnection::Query& query,
|
|||||||
try {
|
try {
|
||||||
WriteRESP(*strm, query, yc);
|
WriteRESP(*strm, query, yc);
|
||||||
strm->async_flush(yc);
|
strm->async_flush(yc);
|
||||||
} catch (const boost::coroutines::detail::forced_unwind&) {
|
} catch (const std::exception&) {
|
||||||
throw;
|
|
||||||
} catch (...) {
|
|
||||||
if (m_Connecting.exchange(false)) {
|
if (m_Connecting.exchange(false)) {
|
||||||
m_Connected.store(false);
|
m_Connected.store(false);
|
||||||
stream = nullptr;
|
stream = nullptr;
|
||||||
|
@ -439,9 +439,7 @@ bool ApiListener::AddListener(const String& node, const String& service)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
tcp::resolver resolver (io);
|
tcp::resolver resolver (io);
|
||||||
tcp::resolver::query query (node, service, tcp::resolver::query::passive);
|
auto result (resolver.resolve(node.GetData(), service.GetData(), tcp::resolver::passive));
|
||||||
|
|
||||||
auto result (resolver.resolve(query));
|
|
||||||
auto current (result.begin());
|
auto current (result.begin());
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -212,7 +212,7 @@ void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
|
|||||||
|
|
||||||
Ptr keepAlive (this);
|
Ptr keepAlive (this);
|
||||||
|
|
||||||
m_IoStrand.post([this, keepAlive, message]() { SendMessageInternal(message); });
|
boost::asio::post(m_IoStrand, [this, keepAlive, message] { SendMessageInternal(message); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonRpcConnection::SendRawMessage(const String& message)
|
void JsonRpcConnection::SendRawMessage(const String& message)
|
||||||
@ -223,7 +223,7 @@ void JsonRpcConnection::SendRawMessage(const String& message)
|
|||||||
|
|
||||||
Ptr keepAlive (this);
|
Ptr keepAlive (this);
|
||||||
|
|
||||||
m_IoStrand.post([this, keepAlive, message]() {
|
boost::asio::post(m_IoStrand, [this, keepAlive, message] {
|
||||||
if (m_ShuttingDown) {
|
if (m_ShuttingDown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ BOOST_AUTO_TEST_CASE(timeout_run)
|
|||||||
boost::asio::io_context::strand strand (io);
|
boost::asio::io_context::strand strand (io);
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
|
||||||
boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
|
IoEngine::SpawnCoroutine(strand, [&](boost::asio::yield_context yc) {
|
||||||
boost::asio::deadline_timer timer (io);
|
boost::asio::deadline_timer timer (io);
|
||||||
|
|
||||||
Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
|
Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
|
||||||
@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(timeout_cancelled)
|
|||||||
boost::asio::io_context::strand strand (io);
|
boost::asio::io_context::strand strand (io);
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
|
||||||
boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
|
IoEngine::SpawnCoroutine(strand, [&](boost::asio::yield_context yc) {
|
||||||
boost::asio::deadline_timer timer (io);
|
boost::asio::deadline_timer timer (io);
|
||||||
Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
|
Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(timeout_scope)
|
|||||||
boost::asio::io_context::strand strand (io);
|
boost::asio::io_context::strand strand (io);
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
|
||||||
boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
|
IoEngine::SpawnCoroutine(strand, [&](boost::asio::yield_context yc) {
|
||||||
boost::asio::deadline_timer timer (io);
|
boost::asio::deadline_timer timer (io);
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(timeout_due_cancelled)
|
|||||||
boost::asio::io_context::strand strand (io);
|
boost::asio::io_context::strand strand (io);
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
|
||||||
boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
|
IoEngine::SpawnCoroutine(strand, [&](boost::asio::yield_context yc) {
|
||||||
boost::asio::deadline_timer timer (io);
|
boost::asio::deadline_timer timer (io);
|
||||||
Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
|
Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(timeout_due_scope)
|
|||||||
boost::asio::io_context::strand strand (io);
|
boost::asio::io_context::strand strand (io);
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
|
||||||
boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
|
IoEngine::SpawnCoroutine(strand, [&](boost::asio::yield_context yc) {
|
||||||
boost::asio::deadline_timer timer (io);
|
boost::asio::deadline_timer timer (io);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -34,10 +34,10 @@ if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
|
|||||||
$env:OPENSSL_ROOT_DIR = 'c:\local\OpenSSL-Win64'
|
$env:OPENSSL_ROOT_DIR = 'c:\local\OpenSSL-Win64'
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:BOOST_ROOT)) {
|
if (-not (Test-Path env:BOOST_ROOT)) {
|
||||||
$env:BOOST_ROOT = 'c:\local\boost_1_86_0'
|
$env:BOOST_ROOT = 'c:\local\boost_1_87_0'
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
|
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
|
||||||
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_86_0\lib64-msvc-14.2'
|
$env:BOOST_LIBRARYDIR = 'c:\local\boost_1_87_0\lib64-msvc-14.2'
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:FLEX_BINARY)) {
|
if (-not (Test-Path env:FLEX_BINARY)) {
|
||||||
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
|
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
|
||||||
|
@ -36,10 +36,10 @@ if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
|
|||||||
$env:OPENSSL_ROOT_DIR = "c:\local\OpenSSL_3_0_15-Win${env:BITS}"
|
$env:OPENSSL_ROOT_DIR = "c:\local\OpenSSL_3_0_15-Win${env:BITS}"
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:BOOST_ROOT)) {
|
if (-not (Test-Path env:BOOST_ROOT)) {
|
||||||
$env:BOOST_ROOT = "c:\local\boost_1_86_0-Win${env:BITS}"
|
$env:BOOST_ROOT = "c:\local\boost_1_87_0-Win${env:BITS}"
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
|
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
|
||||||
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_86_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
|
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_87_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
|
||||||
}
|
}
|
||||||
if (-not (Test-Path env:FLEX_BINARY)) {
|
if (-not (Test-Path env:FLEX_BINARY)) {
|
||||||
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
|
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user