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

Method onReaderPayload

Libraries/Http/HttpWebSocket.cpp:1182–1205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1180}
1181
1182Result HttpWebSocketEndpoint::onReaderPayload(Span<char> payload, bool frameFinished)
1183{
1184 if (currentFrame.isControlFrame())
1185 {
1186 SC_TRY_MSG(controlPayloadSize + payload.sizeInBytes() <= sizeof(controlPayload),
1187 "HttpWebSocketEndpoint control payload too large");
1188 if (payload.sizeInBytes() > 0)
1189 {
1190 ::memcpy(controlPayload + controlPayloadSize, payload.data(), payload.sizeInBytes());
1191 controlPayloadSize += payload.sizeInBytes();
1192 }
1193 if (frameFinished)
1194 {
1195 SC_TRY(handleControlFrame({controlPayload, controlPayloadSize}));
1196 }
1197 return Result(true);
1198 }
1199
1200 if (onDataFramePayload.isValid())
1201 {
1202 SC_TRY(onDataFramePayload(currentFrame.opcode, payload, frameFinished));
1203 }
1204 return Result(true);
1205}
1206
1207Result HttpWebSocketEndpoint::handleControlFrame(Span<char> payload)
1208{

Callers

nothing calls this directly

Calls 5

isControlFrameMethod · 0.80
ResultClass · 0.50
sizeInBytesMethod · 0.45
dataMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected