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

Method UnlockAndFlushToBodyReader

src/brpc/details/http_message.cpp:225–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225int HttpMessage::UnlockAndFlushToBodyReader(std::unique_lock<butil::Mutex>& mu) {
226 if (_body.empty()) {
227 mu.unlock();
228 return 0;
229 }
230 butil::IOBuf body_seen = _body.movable();
231 ProgressiveReader* r = _body_reader;
232 mu.unlock();
233 for (size_t i = 0; i < body_seen.backing_block_num(); ++i) {
234 butil::StringPiece blk = body_seen.backing_block(i);
235 butil::Status st = r->OnReadOnePart(blk.data(), blk.size());
236 if (!st.ok()) {
237 mu.lock();
238 _body_reader = NULL;
239 mu.unlock();
240 r->OnEndOfMessage(st);
241 return -1;
242 }
243 }
244 return 0;
245}
246
247int HttpMessage::on_body_cb(http_parser *parser,
248 const char *at, const size_t length) {

Callers

nothing calls this directly

Calls 11

movableMethod · 0.80
backing_blockMethod · 0.80
okMethod · 0.80
emptyMethod · 0.45
unlockMethod · 0.45
backing_block_numMethod · 0.45
OnReadOnePartMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
lockMethod · 0.45
OnEndOfMessageMethod · 0.45

Tested by

no test coverage detected