feat: Integrate new webserver (#1722)

For #919.
The new web server is not using dosguard yet. It will be fixed by a
separate PR.
This commit is contained in:
Sergey Kuznetsov
2024-11-21 14:48:32 +00:00
committed by GitHub
parent fc3ba07f2e
commit c77154a5e6
90 changed files with 4029 additions and 683 deletions

View File

@@ -155,10 +155,12 @@ TEST_F(CoroutineGroupTests, TooManyCoroutines)
}));
EXPECT_FALSE(group.spawn(yield, [this](boost::asio::yield_context) { callback2_.Call(); }));
EXPECT_TRUE(group.isFull());
boost::asio::steady_timer timer{yield.get_executor(), std::chrono::milliseconds{2}};
timer.async_wait(yield);
EXPECT_FALSE(group.isFull());
EXPECT_TRUE(group.spawn(yield, [this](boost::asio::yield_context) { callback2_.Call(); }));
group.asyncWait(yield);
@@ -166,16 +168,28 @@ TEST_F(CoroutineGroupTests, TooManyCoroutines)
});
}
TEST_F(CoroutineGroupTests, CanSpawn)
TEST_F(CoroutineGroupTests, SpawnForeign)
{
EXPECT_CALL(callback1_, Call);
testing::Sequence const sequence;
EXPECT_CALL(callback1_, Call).InSequence(sequence);
EXPECT_CALL(callback2_, Call).InSequence(sequence);
runSpawn([this](boost::asio::yield_context yield) {
CoroutineGroup group{yield, 1};
EXPECT_TRUE(group.canSpawn());
group.spawn(yield, [&group, this](boost::asio::yield_context) {
auto const onForeignComplete = group.registerForeign();
[&]() { ASSERT_TRUE(onForeignComplete.has_value()); }();
[&]() { ASSERT_FALSE(group.registerForeign().has_value()); }();
boost::asio::spawn(ctx, [this, &onForeignComplete](boost::asio::yield_context innerYield) {
boost::asio::steady_timer timer{innerYield.get_executor(), std::chrono::milliseconds{2}};
timer.async_wait(innerYield);
callback1_.Call();
EXPECT_FALSE(group.canSpawn());
onForeignComplete->operator()();
});
group.asyncWait(yield);
callback2_.Call();
});
}