nghttp: Verbose output for received DATA chunk with current received window

This commit is contained in:
Tatsuhiro Tsujikawa 2014-08-10 17:15:35 +09:00
parent 24cfb52b5a
commit 58afce2382
3 changed files with 28 additions and 1 deletions

View File

@ -443,10 +443,11 @@ int verbose_on_header_callback(nghttp2_session *session,
}; };
print_timer(); print_timer();
fprintf(outfile, " (stream_id=%d, noind=%d) ", frame->hd.stream_id, fprintf(outfile, " recv (stream_id=%d, noind=%d) ", frame->hd.stream_id,
(flags & NGHTTP2_NV_FLAG_NO_INDEX) != 0); (flags & NGHTTP2_NV_FLAG_NO_INDEX) != 0);
print_nv(&nv); print_nv(&nv);
fflush(outfile);
return 0; return 0;
} }
@ -509,6 +510,23 @@ int verbose_on_frame_send_callback
return 0; return 0;
} }
int verbose_on_data_chunk_recv_callback
(nghttp2_session *session, uint8_t flags, int32_t stream_id,
const uint8_t *data, size_t len, void *user_data)
{
print_timer();
auto srecv = nghttp2_session_get_stream_effective_recv_data_length
(session, stream_id);
auto crecv = nghttp2_session_get_effective_recv_data_length(session);
fprintf(outfile,
" recv (stream_id=%d, length=%zu, srecv=%d, crecv=%d) DATA\n",
stream_id, len, srecv, crecv);
fflush(outfile);
return 0;
}
namespace { namespace {
std::chrono::steady_clock::time_point base_tv; std::chrono::steady_clock::time_point base_tv;
} // namespace } // namespace

View File

@ -63,6 +63,10 @@ int verbose_on_unknown_frame_recv_callback(nghttp2_session *session,
int verbose_on_frame_send_callback int verbose_on_frame_send_callback
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data); (nghttp2_session *session, const nghttp2_frame *frame, void *user_data);
int verbose_on_data_chunk_recv_callback
(nghttp2_session *session, uint8_t flags, int32_t stream_id,
const uint8_t *data, size_t len, void *user_data);
// Returns difference between |a| and |b| in milliseconds, assuming // Returns difference between |a| and |b| in milliseconds, assuming
// |a| is more recent than |b|. // |a| is more recent than |b|.
template<typename TimePoint> template<typename TimePoint>

View File

@ -1135,6 +1135,11 @@ int on_data_chunk_recv_callback
return 0; return 0;
} }
if(config.verbose) {
verbose_on_data_chunk_recv_callback(session, flags, stream_id, data, len,
user_data);
}
if(req->status == 0) { if(req->status == 0) {
nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE,
stream_id, NGHTTP2_PROTOCOL_ERROR); stream_id, NGHTTP2_PROTOCOL_ERROR);