MCPcopy Create free account
hub / github.com/apache/thrift / finish

Method finish

lib/cpp/src/thrift/async/TEvhttpClientChannel.cpp:109–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void TEvhttpClientChannel::finish(struct evhttp_request* req) {
110 assert(!completionQueue_.empty());
111 Completion completion = completionQueue_.front();
112 completionQueue_.pop();
113 if (req == nullptr) {
114 try {
115 completion.first();
116 } catch (const TTransportException& e) {
117 if (e.getType() == TTransportException::END_OF_FILE)
118 throw TException("connect failed");
119 else
120 throw;
121 }
122 return;
123 } else if (req->response_code != 200) {
124 try {
125 completion.first();
126 } catch (const TTransportException& e) {
127 std::stringstream ss;
128 ss << "server returned code " << req->response_code;
129 if (req->response_code_line)
130 ss << ": " << req->response_code_line;
131 if (e.getType() == TTransportException::END_OF_FILE)
132 throw TException(ss.str());
133 else
134 throw;
135 }
136 return;
137 }
138 completion.second->resetBuffer(EVBUFFER_DATA(req->input_buffer),
139 static_cast<uint32_t>(EVBUFFER_LENGTH(req->input_buffer)));
140 completion.first();
141 return;
142}
143
144/* static */ void TEvhttpClientChannel::response(struct evhttp_request* req, void* arg) {
145 auto* self = (TEvhttpClientChannel*)arg;

Callers 1

responseMethod · 0.95

Calls 6

emptyMethod · 0.80
strMethod · 0.80
resetBufferMethod · 0.80
TExceptionClass · 0.50
popMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected