This is an automated email from the ASF dual-hosted git repository.

zwoop 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 89403ff  Cleanup server_entry before do dns lookup
89403ff is described below

commit 89403ff6aabadef26511712841cf0c82517ffb4b
Author: Oknet Xu <[email protected]>
AuthorDate: Thu Jun 1 13:37:02 2017 +0800

    Cleanup server_entry before do dns lookup
    
    ATS has server connection retry mechanism. It tries to connect
    server ip first then other ip by DNS round robin.
    
    Currently, ATS will do cleanup server_entry before retry to connect
    server ip. But it does not cleanup server_entry before do dns lookup.
---
 proxy/http/HttpSM.cc | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 53e1290..b9ca8cd 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7234,6 +7234,32 @@ HttpSM::set_next_state()
 
     HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_hostdb_lookup);
 
+    // We need to close the previous attempt
+    // Because it could be a server side retry by DNS rr
+    if (server_entry) {
+      ink_assert(server_entry->vc_type == HTTP_SERVER_VC);
+      vc_table.cleanup_entry(server_entry);
+      server_entry   = nullptr;
+      server_session = nullptr;
+    } else {
+      // Now that we have gotten the user agent request, we can cancel
+      // the inactivity timeout associated with it.  Note, however, that
+      // we must not cancel the inactivity timeout if the message
+      // contains a body (as indicated by the non-zero request_content_length
+      // field).  This indicates that a POST operation is taking place and
+      // that the client is still sending data to the origin server.  The
+      // origin server cannot reply until the entire request is received.  In
+      // light of this dependency, TS must ensure that the client finishes
+      // sending its request and for this reason, the inactivity timeout
+      // cannot be cancelled.
+      if (ua_session && !t_state.hdr_info.request_content_length) {
+        ua_session->cancel_inactivity_timeout();
+      } else if (!ua_session) {
+        terminate_sm = true;
+        return; // Give up if there is no session
+      }
+    }
+
     ink_assert(t_state.dns_info.looking_up != HttpTransact::UNDEFINED_LOOKUP);
     do_hostdb_lookup();
     break;

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to