Go to the source code of this file.
DEFINE_int32 |
( |
http_port |
, |
|
|
11000 |
, |
|
|
"Port to listen on with HTTP protocol" |
|
|
) |
| |
DEFINE_int32 |
( |
h2_port |
, |
|
|
11002 |
, |
|
|
"Port to listen on with HTTP/2 protocol" |
|
|
) |
| |
DEFINE_int32 |
( |
threads |
, |
|
|
0 |
, |
|
|
"Number of threads to listen on. Numbers <= 0 ""will use the number of cores on this machine." |
|
|
) |
| |
DEFINE_string |
( |
ip |
, |
|
|
"localhost" |
, |
|
|
"IP/Hostname to bind to" |
|
|
) |
| |
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 53 of file StaticServer.cpp.
References proxygen::RequestHandlerChain::addThen(), proxygen::HTTPServer::bind(), proxygen::HTTPServerOptions::enableContentCompression, proxygen::HTTPServerOptions::h2cEnabled, proxygen::HTTPServerOptions::handlerFactories, proxygen::HTTPServerOptions::idleTimeout, folly::init(), folly::gen::move, folly::setCPUExecutor(), proxygen::HTTPServerOptions::shutdownOn, proxygen::HTTPServer::start(), folly::pushmi::detail::t, and proxygen::HTTPServerOptions::threads.
56 std::vector<HTTPServer::IPConfig> IPs = {
57 {
SocketAddress(FLAGS_ip, FLAGS_http_port,
true), Protocol::HTTP},
58 {
SocketAddress(FLAGS_ip, FLAGS_h2_port,
true), Protocol::HTTP2},
61 if (FLAGS_threads <= 0) {
62 FLAGS_threads = sysconf(_SC_NPROCESSORS_ONLN);
63 CHECK_GT(FLAGS_threads, 0);
67 options.
threads =
static_cast<size_t>(FLAGS_threads);
68 options.
idleTimeout = std::chrono::milliseconds(60000);
72 .
addThen<StaticHandlerFactory>()
76 auto diskIOThreadPool = std::make_shared<folly::CPUThreadPoolExecutor>(
78 std::make_shared<folly::NamedThreadFactory>(
"StaticDiskIOThread"));
85 std::thread
t([&] () {
std::chrono::milliseconds idleTimeout
constexpr detail::Map< Move > move
RequestHandlerChain & addThen(Args &&...args)
void init(int *argc, char ***argv, bool removeFlags)
std::vector< std::unique_ptr< RequestHandlerFactory > > handlerFactories
std::vector< int > shutdownOn
void setCPUExecutor(std::weak_ptr< Executor > executor)
bool enableContentCompression