| 7 | io_context worker[worker_num], balancer; |
| 8 | |
| 9 | task<> session(int sockfd) { |
| 10 | co_context::socket sock{sockfd}; |
| 11 | char buf[8192]; |
| 12 | int nr = co_await sock.recv(buf); |
| 13 | |
| 14 | while (nr > 0) { |
| 15 | nr = co_await (sock.send({buf, (size_t)nr}) && sock.recv(buf)); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | task<> server(const uint16_t port) { |
| 20 | acceptor ac{inet_address{port}}; |