| 1205 | } |
| 1206 | |
| 1207 | if (frameFinished and currentFrame.fin) |
| 1208 | { |
| 1209 | if (onMessage.isValid()) |
| 1210 | { |
| 1211 | SC_TRY(onMessage(messageOpcode, {messageStorage.data(), messageSize})); |
| 1212 | } |
| 1213 | assemblingMessage = false; |
| 1214 | messageSize = 0; |
| 1215 | } |
| 1216 | return Result(true); |
| 1217 | } |
| 1218 | |
| 1219 | void HttpWebSocketEndpoint::reset(HttpWebSocketEndpointRole role) |
| 1220 | { |
| 1221 | endpointRole = role; |
| 1222 | reader.reset(role); |
| 1223 | writer.reset(role); |
| 1224 | reader.onFrameHeader.bind<HttpWebSocketEndpoint, &HttpWebSocketEndpoint::onReaderFrameHeader>(*this); |
| 1225 | reader.onFramePayload.bind<HttpWebSocketEndpoint, &HttpWebSocketEndpoint::onReaderPayload>(*this); |
| 1226 | |
| 1227 | currentFrame = {}; |
| 1228 | controlPayloadSize = 0; |
| 1229 | pendingControlFrame = {}; |
| 1230 | automaticMaskKeySet = false; |
| 1231 | closeSent = false; |
| 1232 | closeReceived = false; |
| 1233 | } |
| 1234 | |
| 1235 | void HttpWebSocketEndpoint::setAutomaticMaskKey(const uint8_t maskKey[4]) |
| 1236 | { |
| 1237 | for (size_t idx = 0; idx < 4; ++idx) |
| 1238 | { |
| 1239 | automaticMaskKey[idx] = maskKey[idx]; |
| 1240 | } |
| 1241 | automaticMaskKeySet = true; |
| 1242 | } |
| 1243 | |
| 1244 | Result HttpWebSocketEndpoint::receive(Span<char> data, size_t& consumedBytes) |
| 1245 | { |
| 1246 | return reader.parse(data, consumedBytes); |
| 1247 | } |
| 1248 | |
| 1249 | Result HttpWebSocketEndpoint::applyOutgoingMask(HttpWebSocketFrameHeaderView& header, const uint8_t* maskKey) const |
| 1250 | { |
| 1251 | const bool requiresMask = scHttpWebSocketRequiresOutgoingMask(endpointRole); |
nothing calls this directly
no test coverage detected