| 17 | } |
| 18 | |
| 19 | task<> server() { |
| 20 | acceptor ac{inet_address{port}}; |
| 21 | uint32_t turn = 0; |
| 22 | for (int sockfd; (sockfd = co_await ac.accept()) >= 0;) { |
| 23 | worker[turn].co_spawn(reply(co_context::socket{sockfd})); |
| 24 | turn = (turn + 1) % worker_num; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | int main() { |
| 29 | balancer.co_spawn(server()); |