MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / echoConversation

Function echoConversation

Examples/AwaitEcho/AwaitEcho.cpp:90–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90static AwaitTask echoConversation(AwaitEventLoop& await, const SocketDescriptor& serverSocket,
91 const SocketDescriptor& client, SocketIPAddress address, SocketDescriptor& accepted,
92 Span<char> replyBuffer, AwaitSocketReceiveResult& reply)
93{
94 AwaitTask server = echoServer(await, serverSocket, accepted);
95 AwaitTask clientTask = echoClient(await, client, address, replyBuffer, reply);
96
97 AwaitTask* children[2] = {&server, &clientTask};
98 AwaitTaskGroup group(await, children);
99 SC_CO_TRY(group.spawnAll(children));
100 Result waitResult = co_await group.waitAll();
101 if (not waitResult)
102 {
103 co_return Result::Error("AwaitEcho task group failed");
104 }
105
106 co_return Result(true);
107}
108
109static Result runAwaitEcho()
110{

Callers 1

runAwaitEchoFunction · 0.85

Calls 6

echoServerFunction · 0.85
echoClientFunction · 0.85
spawnAllMethod · 0.80
waitAllMethod · 0.80
ErrorEnum · 0.50
ResultClass · 0.50

Tested by

no test coverage detected