MCPcopy Create free account
hub / github.com/dermesser/libsocket / receive_header

Method receive_header

C++/dgramoverstream.cpp:240–257  ·  view source on GitHub ↗

* @brief Receive and decode length header. * @returns The expected length received. * @throws socket_exception */

Source from the content-addressed store, hash-verified

238 * @throws socket_exception
239 */
240uint32_t dgram_over_stream::receive_header(void) {
241 ssize_t pos = 0;
242
243 do {
244 ssize_t result =
245 inner->rcv(prefix_buffer + pos, FRAMING_PREFIX_LENGTH, 0);
246
247 if (result < 0)
248 throw socket_exception(__FILE__, __LINE__,
249 "dgram_over_stream::receive_header(): Could "
250 "not receive length prefix!",
251 false);
252
253 pos += result;
254 } while (pos < 4);
255
256 return decode_uint32(prefix_buffer);
257}
258} // namespace libsocket
259
260/**

Callers

nothing calls this directly

Calls 3

socket_exceptionClass · 0.85
decode_uint32Function · 0.85
rcvMethod · 0.45

Tested by

no test coverage detected