void prepare_close_frame(message::data_ptr msg, close::status::value /*code*/, const std::string& /*reason*/) { assert(msg); if (msg->get_prepared()) { return; } msg->set_header(std::string()); struct Marker { Marker () { value.uc = 0xff; } union { char c; unsigned char uc; } value; }; static Marker marker; std::string val; val.append(1,marker.value.c); val.append(1,0x00); msg->set_payload(val); msg->set_prepared(true); }
void prepare_frame(message::data_ptr msg) { assert(msg); if (msg->get_prepared()) { return; } msg->set_header(std::string(1,0x00)); struct Marker { Marker () { union { char c; unsigned char uc; } v; v.uc = 0xff; value = std::string (1, v.c); } std::string value; }; static Marker marker; msg->append_payload(marker.value); msg->set_prepared(true); }
void prepare_frame(message::data_ptr msg) { assert(msg); if (msg->get_prepared()) { return; } msg->set_header(std::string(1,0x00)); msg->append_payload(std::string(1,0xFF)); msg->set_prepared(true); }
void prepare_close_frame(message::data_ptr msg, close::status::value /*code*/, const std::string& /*reason*/) { assert(msg); if (msg->get_prepared()) { return; } msg->set_header(std::string()); std::string val; val.append(1,0xFF); val.append(1,0x00); msg->set_payload(val); msg->set_prepared(true); }