| 64 | } |
| 65 | |
| 66 | static AwaitTask echoClient(AwaitEventLoop& await, const SocketDescriptor& client, SocketIPAddress address, |
| 67 | Span<char> replyBuffer, AwaitSocketReceiveResult& reply) |
| 68 | { |
| 69 | const char message[] = "niche readable await"; |
| 70 | |
| 71 | Result connectResult = co_await await.connect(client, address); |
| 72 | if (not connectResult) |
| 73 | { |
| 74 | co_return Result::Error("AwaitEcho client connect failed"); |
| 75 | } |
| 76 | Result sendResult = co_await await.sendAll(client, {message, sizeof(message) - 1}); |
| 77 | if (not sendResult) |
| 78 | { |
| 79 | co_return Result::Error("AwaitEcho client sendAll failed"); |
| 80 | } |
| 81 | Result receiveResult = co_await await.receive(client, replyBuffer, reply); |
| 82 | if (not receiveResult) |
| 83 | { |
| 84 | co_return Result::Error("AwaitEcho client receive failed"); |
| 85 | } |
| 86 | |
| 87 | co_return Result(true); |
| 88 | } |
| 89 | |
| 90 | static AwaitTask echoConversation(AwaitEventLoop& await, const SocketDescriptor& serverSocket, |
| 91 | const SocketDescriptor& client, SocketIPAddress address, SocketDescriptor& accepted, |