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

Function probeClient

Examples/AwaitServiceProbe/AwaitServiceProbe.cpp:55–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55static AwaitTask probeClient(AwaitEventLoop& await, const SocketDescriptor& client, SocketIPAddress address,
56 Span<char> replyBuffer, AwaitSocketReceiveResult& reply)
57{
58 const char request[] = "PING";
59
60 SC_CO_TRY(co_await await.connect(client, address));
61 SC_CO_TRY(co_await await.sendAll(client, {request, sizeof(request) - 1}));
62 SC_CO_TRY(co_await await.receive(client, replyBuffer, reply));
63
64 StringView text({reply.data.data(), reply.data.sizeInBytes()}, false, StringEncoding::Ascii);
65 if (text != "PONG")
66 {
67 co_return Result::Error("AwaitServiceProbe received an unexpected response");
68 }
69
70 co_return Result(true);
71}
72
73static AwaitTask slowMaintenance(AwaitEventLoop& await)
74{

Callers 1

networkExchangeFunction · 0.85

Calls 7

sendAllMethod · 0.80
ErrorEnum · 0.50
ResultClass · 0.50
connectMethod · 0.45
receiveMethod · 0.45
dataMethod · 0.45
sizeInBytesMethod · 0.45

Tested by

no test coverage detected