This is an automated email from the ASF dual-hosted git repository.
oknet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 6521444 fix bg_fill abort when server completed
6521444 is described below
commit 652144465188a4dec5df9554c3ee3e23f9bf6cc2
Author: scw00 <[email protected]>
AuthorDate: Sat May 20 15:44:16 2017 +0800
fix bg_fill abort when server completed
---
proxy/http/HttpSM.cc | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 9f62c57..53e1290 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3052,11 +3052,22 @@ HttpSM::is_bg_fill_necessary(HttpTunnelConsumer *c)
{
ink_assert(c->vc_type == HT_HTTP_CLIENT);
- if (c->producer->alive && // something there to
read
- server_entry && server_entry->vc && // from an origin server
- server_session && server_session->get_netvc() && // which is still open
and valid
- c->producer->num_consumers > 1 // with someone else
reading it
+ if (c->producer->alive && // something there to read
+ // server_entry && server_entry->vc
&& // from an origin server
+ // server_session &&
server_session->get_netvc() && // which is still open and valid
+ c->producer->num_consumers > 1 // with someone else reading it
) {
+ HttpTunnelProducer *p = nullptr;
+
+ if (!server_entry || !server_entry->vc || !server_session ||
!server_session->get_netvc()) {
+ // return true if we have finished the reading from OS when client
aborted
+ p = c->producer->self_consumer ? c->producer->self_consumer->producer :
c->producer;
+ if (p->vc_type == HT_HTTP_SERVER && p->read_success) {
+ return true;
+ } else {
+ return false;
+ }
+ }
// If threshold is 0.0 or negative then do background
// fill regardless of the content length. Since this
// is floating point just make sure the number is near zero
@@ -3110,15 +3121,20 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer
*c)
set_ua_abort(HttpTransact::ABORTED, event);
if (is_bg_fill_necessary(c)) {
+ p = c->producer->self_consumer ? c->producer->self_consumer->producer :
c->producer;
DebugSM("http", "[%" PRId64 "] Initiating background fill", sm_id);
- background_fill = BACKGROUND_FILL_STARTED;
- HTTP_INCREMENT_DYN_STAT(http_background_fill_current_count_stat);
+ // check whether to finish the reading.
+ background_fill = p->read_success ? BACKGROUND_FILL_COMPLETED :
BACKGROUND_FILL_STARTED;
// There is another consumer (cache write) so
// detach the user agent
- ink_assert(server_entry->vc == server_session);
- ink_assert(c->is_downstream_from(server_session));
-
server_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout));
+ if (background_fill == BACKGROUND_FILL_STARTED) {
+ HTTP_INCREMENT_DYN_STAT(http_background_fill_current_count_stat);
+ ink_assert(server_entry->vc == server_session);
+ ink_assert(c->is_downstream_from(server_session));
+
server_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout));
+ }
+
} else {
// No background fill
p = c->producer;
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].