mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Refactoring to make it ready for KeepAlive connection on Client
This commit is contained in:
parent
34282c79a9
commit
e022b8b80b
2 changed files with 169 additions and 195 deletions
11
test/test.cc
11
test/test.cc
|
@ -1767,15 +1767,20 @@ TEST_F(ServerTest, GetStreamedEndless) {
|
|||
|
||||
TEST_F(ServerTest, ClientStop) {
|
||||
std::vector<std::thread> threads;
|
||||
for (auto i = 0; i < 3; i++) {
|
||||
for (auto i = 0; i < 100; 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(3));
|
||||
cli_.stop();
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
while (cli_.is_socket_open()) {
|
||||
cli_.stop();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
for (auto &t : threads) {
|
||||
t.join();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue