MCPcopy Create free account
hub / github.com/OpenAtomFoundation/pikiwidb / main

Function main

src/net/examples/https_server.cc:90–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90int 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}

Callers

nothing calls this directly

Calls 8

atoiFunction · 0.85
storeMethod · 0.80
loadMethod · 0.80
SignalSetupFunction · 0.70
NewDispatchThreadFunction · 0.50
EnableSecurityMethod · 0.45
StartThreadMethod · 0.45
StopThreadMethod · 0.45

Tested by

no test coverage detected