| 7 | static const size_t kHeaderLen = sizeof(protocol_binary_response_header); |
| 8 | |
| 9 | void BinaryCodec::OnCodecMessage(const evpp::TCPConnPtr& conn, |
| 10 | evpp::Buffer* buf) { |
| 11 | while (buf->size() >= kHeaderLen) { // kHeaderLen == 24 |
| 12 | const void* data = buf->data(); |
| 13 | protocol_binary_response_header resp = |
| 14 | *static_cast<const protocol_binary_response_header*>(data); |
| 15 | resp.response.bodylen = ntohl(resp.response.bodylen); |
| 16 | resp.response.status = ntohs(resp.response.status); |
| 17 | resp.response.keylen = ntohs(resp.response.keylen); |
| 18 | |
| 19 | if (buf->size() >= resp.response.bodylen + kHeaderLen) { |
| 20 | OnResponsePacket(resp, buf); |
| 21 | } else { |
| 22 | LOG_TRACE << "need recv more data"; |
| 23 | break; |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | |
| 29 | void BinaryCodec::DecodePrefixGetPacket(const protocol_binary_response_header& resp, |
no test coverage detected