Some refactoring on the HTTP codebase
This commit is contained in:
@@ -215,17 +215,17 @@ public:
|
||||
}
|
||||
|
||||
// Maintain existing outgoing HTTP client requests.
|
||||
HttpClientResponseVec http_responses;
|
||||
HttpParserVec http_responses;
|
||||
for (auto &pair : http_client_channels_) {
|
||||
HttpClientChannel &htchan = pair.second;
|
||||
Channel &channel = *htchan.channel_;
|
||||
if (channel.closed() || (channel.in()->fill() > htchan.parsed_bytes_)) {
|
||||
HttpClientResponse response;
|
||||
HttpParser response;
|
||||
if (!channel.error().empty()) {
|
||||
response.fail(503, util::ss("Service Unavailable: ", channel.error()));
|
||||
} else {
|
||||
htchan.parsed_bytes_ = channel.in()->fill();
|
||||
response.parse(channel.in()->view(), channel.closed());
|
||||
response.parse_response(channel.in()->view(), channel.closed());
|
||||
}
|
||||
if (response.complete()) {
|
||||
response.set_request_id(pair.first);
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const HttpClientResponse &response : http_responses) {
|
||||
for (const HttpParser &response : http_responses) {
|
||||
http_client_channels_.erase(response.request_id());
|
||||
}
|
||||
master_->http_responses(http_responses);
|
||||
|
||||
Reference in New Issue
Block a user