| 88 | } |
| 89 | |
| 90 | int main(int argc, char* argv[]) { |
| 91 | int port; |
| 92 | if (argc < 2) { |
| 93 | printf("Usage: ./http_server port"); |
| 94 | } else { |
| 95 | port = atoi(argv[1]); |
| 96 | } |
| 97 | |
| 98 | SignalSetup(); |
| 99 | |
| 100 | std::unique_ptr<ConnFactory> my_conn_factory = std::make_unique<MyConnFactory>(); |
| 101 | std::unique_ptr<ServerThread> st(NewDispatchThread(port, 4, my_conn_factory.get(), 1000)); |
| 102 | |
| 103 | #if __ENABLE_SSL |
| 104 | if (st->EnableSecurity("/complete_path_to/host.crt", "/complete_path_to/host.key") != 0) { |
| 105 | printf("EnableSecurity error happened!\n"); |
| 106 | exit(-1); |
| 107 | } |
| 108 | #endif |
| 109 | |
| 110 | if (st->StartThread() != 0) { |
| 111 | printf("StartThread error happened!\n"); |
| 112 | exit(-1); |
| 113 | } |
| 114 | running.store(true); |
| 115 | while (running.load()) { |
| 116 | sleep(1); |
| 117 | } |
| 118 | st->StopThread(); |
| 119 | |
| 120 | return 0; |
| 121 | } |
nothing calls this directly
no test coverage detected