MCPcopy Create free account
hub / github.com/Codesire-Deng/co_context / server

Function server

test/httpd.cpp:261–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261task<> server(const uint16_t port) {
262 acceptor ac{inet_address{port}};
263 printf("ZeroHTTPd listening on port: %d\n", DEFAULT_SERVER_PORT);
264
265 for (int sockfd; (sockfd = co_await ac.accept()) >= 0;) {
266 co_spawn(session(sockfd));
267 }
268}
269
270void sigint_handler([[maybe_unused]] int signo) {
271 log::w("^C pressed. Shutting down.\n");

Callers 1

mainFunction · 0.70

Calls 3

co_spawnFunction · 0.85
acceptMethod · 0.80
sessionFunction · 0.70

Tested by

no test coverage detected