void TCParser::_parsePong(const std::vector<std::string> &args) { if (args.size() != 1) { _parserError(tcrec_cmd_pong, "Bad pong argument"); return; } doPong(args[0]); }
bool http_servlet::doWebsocket(acl::HttpServletRequest& req, acl::HttpServletResponse&) { acl::socket_stream& ss = req.getSocketStream(); acl::websocket in(ss), out(ss); while (true) { if (in.read_frame_head() == false) { printf("read_frame_head error\r\n"); return false; } bool ret; unsigned char opcode = in.get_frame_opcode(); printf("opcode: 0x%x\r\n", opcode); switch (opcode) { case acl::FRAME_PING: ret = doPing(in, out); break; case acl::FRAME_PONG: ret = doPong(in, out); break; case acl::FRAME_CLOSE: ret = doClose(in, out); break; case acl::FRAME_TEXT: case acl::FRAME_BINARY: ret = doMsg(in, out); break; case acl::FRAME_CONTINUATION: ret = false; break; default: ret = false; break; } if (ret == false) return false; } // XXX: NOT REACHED return false; }