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

Method Run

src/brpc/nshead_pb_service_adaptor.cpp:72–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void SendNsheadPbResponse::Run() {
73 MethodStatus* saved_status = status;
74 const int64_t received_us = done->received_us();
75 if (!cntl->IsCloseConnection()) {
76 adaptor->SerializeResponseToIOBuf(meta, cntl, pbres.get(), ns_res);
77 }
78
79 const bool saved_failed = cntl->Failed();
80 NsheadClosure* saved_done = done;
81 // The space is allocated by NsheadClosure, don't delete.
82 this->~SendNsheadPbResponse();
83
84 // NOTE: *this was destructed, don't touch anything.
85
86 // FIXME(gejun): We can't put this after saved_done->Run() where the
87 // service containing saved_status may be destructed (upon server's
88 // quiting). Thus the latency does not include the time of sending
89 // back response.
90 if (saved_status) {
91 saved_status->OnResponded(
92 !saved_failed, butil::cpuwide_time_us() - received_us);
93 }
94 saved_done->Run();
95}
96
97void NsheadPbServiceAdaptor::ProcessNsheadRequest(
98 const Server& server, Controller* controller,

Callers 1

ProcessNsheadRequestMethod · 0.45

Calls 8

~SendNsheadPbResponseMethod · 0.95
cpuwide_time_usFunction · 0.85
IsCloseConnectionMethod · 0.80
received_usMethod · 0.45
getMethod · 0.45
FailedMethod · 0.45
OnRespondedMethod · 0.45

Tested by

no test coverage detected