nghttpx: Fix sent bodylen logging

This commit is contained in:
Tatsuhiro Tsujikawa 2015-10-03 19:14:26 +09:00
parent ccbaaa1e14
commit e95b39d534
1 changed files with 7 additions and 10 deletions

View File

@ -689,8 +689,10 @@ int send_data_callback(nghttp2_session *session, nghttp2_frame *frame,
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
if (nwrite > 0) {
downstream->add_response_sent_bodylen(nwrite);
// We have to add length here, so that we can log this amount of
// data transferred.
if (length > 0) {
downstream->add_response_sent_bodylen(length);
}
return nwrite < length ? NGHTTP2_ERR_PAUSE : 0;
@ -948,16 +950,11 @@ int Http2Upstream::on_write() {
wb_.write(nwrite);
data_pendinglen_ -= nwrite;
if (pending_data_downstream_) {
if (nwrite > 0 &&
pending_data_downstream_->resume_read(SHRPX_NO_BUFFER, nwrite) !=
0) {
if (pending_data_downstream_ && nwrite > 0) {
if (pending_data_downstream_->resume_read(SHRPX_NO_BUFFER, nwrite) !=
0) {
return -1;
}
if (nwrite > 0) {
pending_data_downstream_->add_response_sent_bodylen(nwrite);
}
}
if (data_pendinglen_ > 0) {