Example #1
0
    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);
    }
Example #2
0
 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);
 }