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

Method EstimatedByteSize

src/brpc/policy/http2_rpc_protocol.cpp:1596–1614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1594}
1595
1596size_t H2UnsentRequest::EstimatedByteSize() {
1597 size_t sz = 0;
1598 for (size_t i = 0; i < _size; ++i) {
1599 sz += _list[i].name.size() + _list[i].value.size() + 1;
1600 }
1601 std::unique_lock<butil::Mutex> mu(_mutex);
1602 if (_cntl == NULL) {
1603 return 0;
1604 }
1605 if (_cntl->has_http_request()) {
1606 const HttpHeader& h = _cntl->http_request();
1607 for (HttpHeader::HeaderIterator it = h.HeaderBegin();
1608 it != h.HeaderEnd(); ++it) {
1609 sz += it->first.size() + it->second.size() + 1;
1610 }
1611 }
1612 sz += _cntl->request_attachment().size();
1613 return sz;
1614}
1615
1616void H2UnsentRequest::Print(std::ostream& os) const {
1617 os << "[ H2 REQUEST @" << butil::my_ip() << " ]\n";

Callers 2

IssueRPCMethod · 0.45
~HttpResponseSenderMethod · 0.45

Calls 4

has_http_requestMethod · 0.80
HeaderBeginMethod · 0.80
HeaderEndMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected