| 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); |
nothing calls this directly
no test coverage detected