MCPcopy Create free account
hub / github.com/Qihoo360/evpp / OnCodecMessage

Method OnCodecMessage

apps/evmc/binary_codec.cc:9–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7static const size_t kHeaderLen = sizeof(protocol_binary_response_header);
8
9void 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
29void BinaryCodec::DecodePrefixGetPacket(const protocol_binary_response_header& resp,

Callers 1

OnResponseDataMethod · 0.80

Calls 2

dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected