MCPcopy Create free account
hub / github.com/acl-dev/acl / read_request

Method read_request

lib_rpc/src/http_stream.cpp:157–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157bool http_response::read_request(MessageLite* out)
158{
159 if (out == NULL)
160 return false;
161
162#ifdef DEBUG
163 struct timeval begin, end;
164 gettimeofday(&begin, NULL);
165#endif
166
167 if (response_->read_header() == false)
168 return false;
169
170#ifdef DEBUG
171 gettimeofday(&end, NULL);
172 header_spent_ = stamp_sub(&end, &begin);
173#endif
174
175 acl::string buf;
176
177#ifdef DEBUG
178 gettimeofday(&begin, NULL);
179#endif
180
181 if (response_->get_body(buf) == false)
182 return false;
183
184#ifdef DEBUG
185 gettimeofday(&end, NULL);
186 body_spent_ = stamp_sub(&end, &begin);
187#endif
188
189 std::string data(buf.c_str(), (int) buf.length());
190
191#ifdef DEBUG
192 gettimeofday(&begin, NULL);
193#endif
194
195 bool ret = out->ParseFromString(data);
196
197#ifdef DEBUG
198 gettimeofday(&end, NULL);
199 parse_spent_ = stamp_sub(&end, &begin);
200#endif
201
202 return ret;
203}
204
205bool http_response::send_response(const MessageLite& in)
206{

Callers 1

handle_oneFunction · 0.45

Calls 6

stamp_subFunction · 0.70
gettimeofdayFunction · 0.50
read_headerMethod · 0.45
get_bodyMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected