MCPcopy Create free account
hub / github.com/apache/brpc / OnReadOnePart

Method OnReadOnePart

test/brpc_http_rpc_protocol_unittest.cpp:720–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718 }
719
720 butil::Status OnReadOnePart(const void* data, size_t length) {
721 _nread += length;
722 while (length > 0) {
723 size_t nappend = std::min(_buf.size() + length, PA_DATA_LEN) - _buf.size();
724 _buf.append((const char*)data, nappend);
725 data = (const char*)data + nappend;
726 length -= nappend;
727 if (_buf.size() >= PA_DATA_LEN) {
728 EXPECT_EQ(PA_DATA_LEN, _buf.size());
729 char expected[PA_DATA_LEN];
730 CopyPAPrefixedWithSeqNo(expected, _ncount++);
731 EXPECT_EQ(0, memcmp(expected, _buf.data(), PA_DATA_LEN))
732 << "ncount=" << _ncount;
733 _buf.clear();
734 }
735 }
736 return butil::Status::OK();
737 }
738 void OnEndOfMessage(const butil::Status& st) {
739 butil::intrusive_ptr<ReadBody>(this, false); // deref
740 ASSERT_LT(_buf.size(), PA_DATA_LEN);

Callers

nothing calls this directly

Calls 5

CopyPAPrefixedWithSeqNoFunction · 0.85
sizeMethod · 0.45
appendMethod · 0.45
dataMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected