MCPcopy Create free account
hub / github.com/apache/thrift / main

Function main

test/cpp/src/TestServer.cpp:624–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622namespace po = boost::program_options;
623
624int main(int argc, char** argv) {
625
626 string testDir = boost::filesystem::system_complete(argv[0]).parent_path().parent_path().parent_path().string();
627 string certPath = testDir + "/keys/server.crt";
628 string keyPath = testDir + "/keys/server.key";
629
630#if _WIN32
631 transport::TWinsockSingleton::create();
632#endif
633 int port = 9090;
634 bool ssl = false;
635 bool zlib = false;
636 string transport_type = "buffered";
637 string protocol_type = "binary";
638 string server_type = "simple";
639 string domain_socket = "";
640 bool abstract_namespace = false;
641 bool emulate_socketactivation = false;
642 std::unique_ptr<DomainSocketFd> domain_socket_fd;
643 size_t workers = 4;
644 int string_limit = 0;
645 int container_limit = 0;
646
647 po::options_description desc("Allowed options");
648 desc.add_options()
649 ("help,h", "produce help message")
650 ("port", po::value<int>(&port)->default_value(port), "Port number to listen")
651 ("domain-socket", po::value<string>(&domain_socket) ->default_value(domain_socket), "Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)")
652 ("abstract-namespace", "Create the domain socket in the Abstract Namespace (no connection with filesystem pathnames)")
653 ("emulate-socketactivation","Open the socket from the tester program and pass the library an already open fd")
654 ("server-type", po::value<string>(&server_type)->default_value(server_type), "type of server, \"simple\", \"thread-pool\", \"threaded\", or \"nonblocking\"")
655 ("transport", po::value<string>(&transport_type)->default_value(transport_type), "transport: buffered, framed, http, websocket, zlib")
656 ("protocol", po::value<string>(&protocol_type)->default_value(protocol_type), "protocol: binary, compact, header, json, multi, multic, multih, multij")
657 ("ssl", "Encrypted Transport using SSL")
658 ("zlib", "Wrapped Transport using Zlib")
659 ("processor-events", "processor-events")
660 ("workers,n", po::value<size_t>(&workers)->default_value(workers), "Number of thread pools workers. Only valid for thread-pool server type")
661 ("string-limit", po::value<int>(&string_limit))
662 ("container-limit", po::value<int>(&container_limit));
663
664 po::variables_map vm;
665 po::store(po::parse_command_line(argc, argv, desc), vm);
666 po::notify(vm);
667
668 if (vm.count("help")) {
669 cout << desc << "\n";
670 return 1;
671 }
672
673 try {
674 if (!server_type.empty()) {
675 if (server_type == "simple") {
676 } else if (server_type == "thread-pool") {
677 } else if (server_type == "threaded") {
678 } else if (server_type == "nonblocking") {
679 } else {
680 throw invalid_argument("Unknown server type " + server_type);
681 }

Callers

nothing calls this directly

Calls 15

emptyMethod · 0.80
loadCertificateMethod · 0.80
loadPrivateKeyMethod · 0.80
ciphersMethod · 0.80
setDetachedMethod · 0.80
storeFunction · 0.50
countMethod · 0.45
whatMethod · 0.45
setContainerSizeLimitMethod · 0.45
setStringSizeLimitMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected