h2load: Fix crash when dealing connection: close with HTTP/1.1 server
This commit is contained in:
parent
faad041868
commit
8e06e37375
|
@ -360,6 +360,16 @@ void Client::fail() {
|
||||||
|
|
||||||
if (new_connection_requested) {
|
if (new_connection_requested) {
|
||||||
new_connection_requested = false;
|
new_connection_requested = false;
|
||||||
|
if (req_started < req_todo) {
|
||||||
|
// At the moment, we don't have a facility to re-start request
|
||||||
|
// already in in-flight. Make them fail.
|
||||||
|
auto req_abandoned = req_started - req_done;
|
||||||
|
|
||||||
|
worker->stats.req_failed += req_abandoned;
|
||||||
|
worker->stats.req_error += req_abandoned;
|
||||||
|
worker->stats.req_done += req_abandoned;
|
||||||
|
|
||||||
|
req_done = req_started;
|
||||||
|
|
||||||
// Keep using current address
|
// Keep using current address
|
||||||
if (connect() == 0) {
|
if (connect() == 0) {
|
||||||
|
@ -367,6 +377,7 @@ void Client::fail() {
|
||||||
}
|
}
|
||||||
std::cerr << "client could not connect to host" << std::endl;
|
std::cerr << "client could not connect to host" << std::endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
process_abandoned_streams();
|
process_abandoned_streams();
|
||||||
}
|
}
|
||||||
|
@ -377,6 +388,7 @@ void Client::disconnect() {
|
||||||
ev_timer_stop(worker->loop, &request_timeout_watcher);
|
ev_timer_stop(worker->loop, &request_timeout_watcher);
|
||||||
streams.clear();
|
streams.clear();
|
||||||
session.reset();
|
session.reset();
|
||||||
|
wb.reset();
|
||||||
state = CLIENT_IDLE;
|
state = CLIENT_IDLE;
|
||||||
ev_io_stop(worker->loop, &wev);
|
ev_io_stop(worker->loop, &wev);
|
||||||
ev_io_stop(worker->loop, &rev);
|
ev_io_stop(worker->loop, &rev);
|
||||||
|
|
|
@ -51,7 +51,15 @@ Http1Session::~Http1Session() {}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// HTTP response message begin
|
// HTTP response message begin
|
||||||
int htp_msg_begincb(http_parser *htp) { return 0; }
|
int htp_msg_begincb(http_parser *htp) {
|
||||||
|
auto session = static_cast<Http1Session *>(htp->data);
|
||||||
|
|
||||||
|
if (session->stream_resp_counter_ >= session->stream_req_counter_) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
Loading…
Reference in New Issue