httpd: allow switching network stack

This commit is contained in:
Avi Kivity
2014-09-10 13:46:54 +03:00
parent e1e85ca5ff
commit bb26a0c08a
2 changed files with 20 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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