mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-16 17:58:28 +00:00
Made a temporary fix for OpenSSL thread problem
This commit is contained in:
parent
4320d7ba3e
commit
5574d82eb3
2 changed files with 27 additions and 9 deletions
14
test/test.cc
14
test/test.cc
|
@ -263,7 +263,7 @@ protected:
|
|||
res.set_content("Hello World!", "text/plain");
|
||||
})
|
||||
.get("/slow", [&](const Request& /*req*/, Response& res) {
|
||||
msleep(3000);
|
||||
msleep(2000);
|
||||
res.set_content("slow", "text/plain");
|
||||
})
|
||||
.get("/remote_addr", [&](const Request& req, Response& res) {
|
||||
|
@ -368,6 +368,9 @@ protected:
|
|||
|
||||
virtual void TearDown() {
|
||||
svr_.stop();
|
||||
for (auto& t: request_threads_) {
|
||||
t.join();
|
||||
}
|
||||
t_.join();
|
||||
}
|
||||
|
||||
|
@ -380,6 +383,7 @@ protected:
|
|||
Server svr_;
|
||||
#endif
|
||||
thread t_;
|
||||
std::vector<thread> request_threads_;
|
||||
};
|
||||
|
||||
TEST_F(ServerTest, GetMethod200)
|
||||
|
@ -736,10 +740,10 @@ TEST_F(ServerTest, GetMethodRemoteAddr)
|
|||
|
||||
TEST_F(ServerTest, SlowRequest)
|
||||
{
|
||||
std::thread([=]() { auto res = cli_.get("/slow"); }).detach();
|
||||
std::thread([=]() { auto res = cli_.get("/slow"); }).detach();
|
||||
std::thread([=]() { auto res = cli_.get("/slow"); }).detach();
|
||||
msleep(1000);
|
||||
request_threads_.push_back(std::thread([=]() { auto res = cli_.get("/slow"); }));
|
||||
request_threads_.push_back(std::thread([=]() { auto res = cli_.get("/slow"); }));
|
||||
request_threads_.push_back(std::thread([=]() { auto res = cli_.get("/slow"); }));
|
||||
msleep(100);
|
||||
}
|
||||
|
||||
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue