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_string (ip,"localhost","IP/Hostname to bind to") |
|
| DEFINE_int32 (threads, 0,"Number of threads to listen on. Numbers <= 0 ""will use the number of cores on this machine.") |
|
| DEFINE_int32 (server_timeout, 60,"How long to wait for a server response (sec)") |
|
int | main (int argc, char *argv[]) |
|
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_int32 |
( |
server_timeout |
, |
|
|
60 |
, |
|
|
"How long to wait for a server response (sec)" |
|
|
) |
| |
DEFINE_string |
( |
ip |
, |
|
|
"localhost" |
, |
|
|
"IP/Hostname to bind to" |
|
|
) |
| |
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 65 of file ProxyServer.cpp.
References proxygen::RequestHandlerChain::addThen(), proxygen::HTTPServer::bind(), proxygen::HTTPServerOptions::enableContentCompression, proxygen::HTTPServerOptions::h2cEnabled, proxygen::HTTPServerOptions::handlerFactories, proxygen::HTTPServerOptions::idleTimeout, folly::gen::move, proxygen::HTTPServerOptions::shutdownOn, proxygen::HTTPServer::start(), proxygen::HTTPServerOptions::supportsConnect, folly::pushmi::detail::t, and proxygen::HTTPServerOptions::threads.
66 gflags::ParseCommandLineFlags(&argc, &
argv,
true);
67 google::InitGoogleLogging(
argv[0]);
68 google::InstallFailureSignalHandler();
70 std::vector<HTTPServer::IPConfig> IPs = {
71 {
SocketAddress(FLAGS_ip, FLAGS_http_port,
true), Protocol::HTTP},
72 {
SocketAddress(FLAGS_ip, FLAGS_h2_port,
true), Protocol::HTTP2},
75 if (FLAGS_threads <= 0) {
76 FLAGS_threads = sysconf(_SC_NPROCESSORS_ONLN);
77 CHECK(FLAGS_threads > 0);
81 options.
threads =
static_cast<size_t>(FLAGS_threads);
82 options.
idleTimeout = std::chrono::milliseconds(60000);
95 std::thread
t([&] () {
std::chrono::milliseconds idleTimeout
constexpr detail::Map< Move > move
RequestHandlerChain & addThen(Args &&...args)
std::vector< std::unique_ptr< RequestHandlerFactory > > handlerFactories
std::vector< int > shutdownOn
bool enableContentCompression