You've already forked cpp-httplib
Fixed Client::stop problem with more than one requests on threads
This commit is contained in:
17
test/test.cc
17
test/test.cc
@ -1766,14 +1766,19 @@ TEST_F(ServerTest, GetStreamedEndless) {
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, ClientStop) {
|
||||
thread t = thread([&]() {
|
||||
auto res = cli_.Get("/streamed-cancel",
|
||||
[&](const char *, uint64_t) { return true; });
|
||||
ASSERT_TRUE(res == nullptr);
|
||||
});
|
||||
std::vector<std::thread> threads;
|
||||
for (auto i = 0; i < 10; i++) {
|
||||
threads.emplace_back(thread([&]() {
|
||||
auto res = cli_.Get("/streamed-cancel",
|
||||
[&](const char *, uint64_t) { return true; });
|
||||
ASSERT_TRUE(res == nullptr);
|
||||
}));
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
cli_.stop();
|
||||
t.join();
|
||||
for (auto& t: threads) {
|
||||
t.join();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, GetWithRange1) {
|
||||
|
Reference in New Issue
Block a user