From bb26a0c08a6508f48a2fdfd8abde418511fab130 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 10 Sep 2014 13:46:54 +0300 Subject: [PATCH] httpd: allow switching network stack --- apps/httpd/httpd.cc | 18 +++++++++++++++++- build.mk | 4 +++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/httpd/httpd.cc b/apps/httpd/httpd.cc index d82bc7168b..9682e25b63 100644 --- a/apps/httpd/httpd.cc +++ b/apps/httpd/httpd.cc @@ -292,7 +292,23 @@ public: int main(int ac, char** av) { http_server server; - server.listen({{}, 10000}); + namespace bpo = boost::program_options; + bpo::options_description opts; + opts.add_options() + ("help", "show help message") + ; + opts.add(reactor::get_options_description()); + bpo::variables_map configuration; + bpo::store(bpo::command_line_parser(ac, av).options(opts).run(), configuration); + bpo::notify(configuration); + if (configuration.count("help")) { + std::cout << opts << "\n"; + return 1; + } + the_reactor.configure(configuration); + the_reactor.start().then([&server] { + server.listen({{}, 10000}); + }); the_reactor.run(); return 0; } diff --git a/build.mk b/build.mk index 566bf941e1..d429116b58 100644 --- a/build.mk +++ b/build.mk @@ -39,12 +39,14 @@ all: apps/seastar/seastar $(tests) apps/httpd/httpd clean: rm seastar $(tests) *.o +libnet = net/virtio.o net/net.o net/ip.o net/ethernet.o net/arp.o net/stack.o + apps/seastar/seastar: apps/seastar/main.o core/reactor.o $(link) tests/test-reactor: tests/test-reactor.o core/reactor.o -apps/httpd/httpd: apps/httpd/httpd.o core/reactor.o +apps/httpd/httpd: apps/httpd/httpd.o core/reactor.o $(libnet) tests/fileiotest: tests/fileiotest.o core/reactor.o