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

Method HandleRpcResponse

src/brpc/stream.cpp:758–780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

756}
757
758void Stream::HandleRpcResponse(butil::IOBuf* response_buffer) {
759 CHECK(!_remote_settings.IsInitialized());
760 CHECK(_host_socket != NULL);
761 std::unique_ptr<butil::IOBuf> buf_guard(response_buffer);
762 ParseResult pr = policy::ParseRpcMessage(response_buffer, NULL, true, NULL);
763 if (!pr.is_ok()) {
764 CHECK(false);
765 Close(EPROTO, "Fail to parse rpc response message");
766 return;
767 }
768 InputMessageBase* msg = pr.message();
769 if (msg == NULL) {
770 CHECK(false);
771 Close(ENOMEM, "Message is NULL");
772 return;
773 }
774 _host_socket->PostponeEOF();
775 _host_socket->ReAddress(&msg->_socket);
776 msg->_received_us = butil::gettimeofday_us();
777 msg->_base_real_us = butil::gettimeofday_us();
778 msg->_arg = NULL; // ProcessRpcResponse() don't need arg
779 policy::ProcessRpcResponse(msg);
780}
781
782int StreamWrite(StreamId stream_id, const butil::IOBuf &message,
783 const StreamWriteOptions* options) {

Callers 1

DEFINE_SMALL_ARRAYFunction · 0.80

Calls 8

ParseRpcMessageFunction · 0.85
ProcessRpcResponseFunction · 0.85
PostponeEOFMethod · 0.80
ReAddressMethod · 0.80
gettimeofday_usFunction · 0.50
IsInitializedMethod · 0.45
is_okMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected