16#ifndef ESI_BACKENDS_RPC_WIRE_H
17#define ESI_BACKENDS_RPC_WIRE_H
32 frame.reserve(8 + size);
34 for (
int i = 0; i < 8; ++i)
35 hdr[i] =
static_cast<uint8_t
>((channelId >> (8 * i)) & 0xFF);
36 frame.append(
reinterpret_cast<const char *
>(hdr), 8);
37 frame.append(
reinterpret_cast<const char *
>(bytes), size);
49 const uint8_t *&payload,
size_t &payloadSize) {
53 for (
int i = 0; i < 8; ++i)
54 id |=
static_cast<uint64_t
>(
static_cast<uint8_t
>(data[i])) << (8 * i);
73 void record(std::exception_ptr ep)
noexcept {
74 std::lock_guard<std::mutex> lock(
mutex);
81 std::exception_ptr ep;
83 std::lock_guard<std::mutex> lock(
mutex);
88 std::rethrow_exception(ep);
Cross-thread error channel for the IXWebSocket network thread.
void record(std::exception_ptr ep) noexcept
Stash the first exception we see (subsequent ones are dropped – the first is the most informative).
void check()
Consume and rethrow the stored fault on the caller's thread, if any.
std::string buildDataFrame(uint64_t channelId, const uint8_t *bytes, size_t size)
Pack a cosim binary data frame: [u64 LE channel_id][payload].
bool parseDataFrame(const std::string &data, uint64_t &channelId, const uint8_t *&payload, size_t &payloadSize)
Parse a cosim binary data frame.
constexpr size_t kDataFrameHeaderSize
Size of the binary data-frame header (LE channel_id).