Common: Get rid of Executor.cpp/h.

There was only one implementation.
This commit is contained in:
Henrik Rydgård authored and Unknown W. Brackets committed 2021-04-30 22:33:34 -07:00
1 parent 8c72cc119e
commit e6aa841b78
12 files changed
+25 -79

No files matched your search

+12 -2
View File
@@ -37,11 +37,21 @@
#include "Common/Net/HTTPServer.h"
#include "Common/Net/Sinks.h"
#include "Common/File/FileDescriptor.h"
#include "Common/Thread/Executor.h"
#include "Common/Buffer.h"
#include "Common/Log.h"
void NewThreadExecutor::Run(std::function<void()> &&func) {
threads_.push_back(std::thread(func));
}
NewThreadExecutor::~NewThreadExecutor() {
// If Run was ever called...
for (auto &thread : threads_)
thread.join();
threads_.clear();
}
namespace http {
// Note: charset here helps prevent XSS.
@@ -126,7 +136,7 @@ void Request::Close() {
}
}
Server::Server(threading::Executor *executor)
Server::Server(NewThreadExecutor *executor)
: port_(0), executor_(executor) {
RegisterHandler("/", std::bind(&Server::HandleListing, this, std::placeholders::_1));
SetFallbackHandler(std::bind(&Server::Handle404, this, std::placeholders::_1));