| 259 | } |
| 260 | |
| 261 | task<> 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 | |
| 270 | void sigint_handler([[maybe_unused]] int signo) { |
| 271 | log::w("^C pressed. Shutting down.\n"); |