Project

General

Profile

Bug #11301 » 0002-Fix-Server-class-to-avoid-race-at-destruction.patch

Bruce Toll, 02/01/2023 10:51 PM

View differences:

test/http/HttpClientServerTest.C
}
};
class Server : public WServer
class Server
{
public:
Server() {
......
"--http-port", "0",
"--docroot", "."
};
setServerConfiguration(argc, (char **)argv);
addResource(&resource_, "/test");
impl_.setServerConfiguration(argc, (char **)argv);
impl_.addResource(&resource_, "/test");
}
std::string address()
{
return "127.0.0.1:" + std::to_string(httpPort());
return "127.0.0.1:" + std::to_string(impl_.httpPort());
}
bool start()
{
return impl_.start();
}
Configuration& configuration()
{
return impl_.configuration();
}
template<typename ... Args>
void addEntryPoint(Args&& ... args)
{
return impl_.addEntryPoint(std::forward<Args>(args)...);
}
TestResource& resource() { return resource_; }
private:
/*
* Note: The order of the resource and server is important. The server must
* be shutdown/destructed before the resource to avoid a use after free for
* requests that are still being handled by the resource on threads.
*/
TestResource resource_;
WServer impl_;
};
class Client : public Wt::WObject {
(2-2/4)