nghttp: Treat stream as success if we see END_STREAM from peer
This commit is contained in:
parent
7b90404072
commit
98add63cdf
|
@ -450,7 +450,7 @@ HttpClient::HttpClient(const nghttp2_session_callbacks *callbacks,
|
||||||
struct ev_loop *loop, SSL_CTX *ssl_ctx)
|
struct ev_loop *loop, SSL_CTX *ssl_ctx)
|
||||||
: session(nullptr), callbacks(callbacks), loop(loop), ssl_ctx(ssl_ctx),
|
: session(nullptr), callbacks(callbacks), loop(loop), ssl_ctx(ssl_ctx),
|
||||||
ssl(nullptr), addrs(nullptr), next_addr(nullptr), cur_addr(nullptr),
|
ssl(nullptr), addrs(nullptr), next_addr(nullptr), cur_addr(nullptr),
|
||||||
complete(0), settings_payloadlen(0), state(ClientState::IDLE),
|
complete(0), success(0), settings_payloadlen(0), state(ClientState::IDLE),
|
||||||
upgrade_response_status_code(0), fd(-1),
|
upgrade_response_status_code(0), fd(-1),
|
||||||
upgrade_response_complete(false) {
|
upgrade_response_complete(false) {
|
||||||
ev_io_init(&wev, writecb, 0, EV_WRITE);
|
ev_io_init(&wev, writecb, 0, EV_WRITE);
|
||||||
|
@ -1744,6 +1744,7 @@ int on_frame_recv_callback2(nghttp2_session *session,
|
||||||
|
|
||||||
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
|
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
|
||||||
req->record_response_end_time();
|
req->record_response_end_time();
|
||||||
|
++client->success;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1780,6 +1781,7 @@ int on_frame_recv_callback2(nghttp2_session *session,
|
||||||
|
|
||||||
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
|
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
|
||||||
req->record_response_end_time();
|
req->record_response_end_time();
|
||||||
|
++client->success;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -2101,10 +2103,9 @@ int communicate(
|
||||||
}
|
}
|
||||||
#endif // HAVE_JANSSON
|
#endif // HAVE_JANSSON
|
||||||
|
|
||||||
if (!client.all_requests_processed()) {
|
if (client.success != client.reqvec.size()) {
|
||||||
std::cerr << "Some requests were not processed. total="
|
std::cerr << "Some requests failed. total=" << client.reqvec.size()
|
||||||
<< client.reqvec.size() << ", processed=" << client.complete
|
<< ", success=" << client.success << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
if (config.stat) {
|
if (config.stat) {
|
||||||
print_stats(client);
|
print_stats(client);
|
||||||
|
|
|
@ -259,6 +259,9 @@ struct HttpClient {
|
||||||
addrinfo *cur_addr;
|
addrinfo *cur_addr;
|
||||||
// The number of completed requests, including failed ones.
|
// The number of completed requests, including failed ones.
|
||||||
size_t complete;
|
size_t complete;
|
||||||
|
// The number of requests that local endpoint received END_STREAM
|
||||||
|
// from peer.
|
||||||
|
size_t success;
|
||||||
// The length of settings_payload
|
// The length of settings_payload
|
||||||
size_t settings_payloadlen;
|
size_t settings_payloadlen;
|
||||||
ClientState state;
|
ClientState state;
|
||||||
|
|
Loading…
Reference in New Issue