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

Method OnMessageComplete

src/brpc/details/http_message.cpp:328–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328int HttpMessage::OnMessageComplete() {
329 if (_vmsgbuilder) {
330 if (_vbodylen > (size_t)FLAGS_http_verbose_max_body_length) {
331 *_vmsgbuilder << "\n<skipped " << _vbodylen
332 - (size_t)FLAGS_http_verbose_max_body_length << " bytes>";
333 }
334 LOG(INFO) << '\n' << _vmsgbuilder->buf();
335 _vmsgbuilder.reset(NULL);
336 }
337 _cur_header.clear();
338 _cur_value = NULL;
339 if (!_read_body_progressively) {
340 // Normal read.
341 _stage = HTTP_ON_MESSAGE_COMPLETE;
342 return 0;
343 }
344 // Progressive read.
345 std::unique_lock<butil::Mutex> mu(_body_mutex);
346 _stage = HTTP_ON_MESSAGE_COMPLETE;
347 if (_body_reader != NULL) {
348 // Solve the case: SetBodyReader quit at ntry=MAX_TRY with non-empty
349 // _body and the remaining _body is just the last part.
350 // Make sure _body is emptied.
351 if (UnlockAndFlushToBodyReader(mu) != 0) {
352 return -1;
353 }
354 mu.lock();
355 ProgressiveReader* r = _body_reader;
356 _body_reader = NULL;
357 mu.unlock();
358 r->OnEndOfMessage(butil::Status());
359 }
360 return 0;
361}
362
363class FailAllRead : public ProgressiveReader {
364public:

Callers 1

Calls 7

bufMethod · 0.80
StatusEnum · 0.50
resetMethod · 0.45
clearMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45
OnEndOfMessageMethod · 0.45

Tested by

no test coverage detected