You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/11/07 22:11:09 UTC

[trafficserver] branch 7.1.x updated: Delete H2 stream before destroy

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

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new df7cbd3  Delete H2 stream before destroy
df7cbd3 is described below

commit df7cbd337ddf3e9244688460b04bcb43707352f3
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Mon Nov 6 12:04:36 2017 +0900

    Delete H2 stream before destroy
    
    (cherry picked from commit faa374373c21a91ddf57f2364b04abc46398e3db)
    
     Conflicts:
    	proxy/http2/Http2Stream.h
---
 proxy/http2/Http2Stream.cc | 19 +++++++++++++------
 proxy/http2/Http2Stream.h  |  1 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index dc30e78..8ba5e19 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -123,9 +123,7 @@ Http2Stream::main_event_handler(int event, void *edata)
   }
   reentrancy_count--;
   // Clean stream up if the terminate flag is set and we are at the bottom of the handler stack
-  if (terminate_stream && reentrancy_count == 0) {
-    destroy();
-  }
+  terminate_if_possible();
 
   return 0;
 }
@@ -358,9 +356,18 @@ Http2Stream::transaction_done()
     ink_assert(cross_thread_event == nullptr);
     // Schedule the destroy to occur after we unwind here.  IF we call directly, may delete with reference on the stack.
     terminate_stream = true;
-    if (terminate_stream && reentrancy_count == 0) {
-      destroy();
-    }
+    terminate_if_possible();
+  }
+}
+
+void
+Http2Stream::terminate_if_possible()
+{
+  if (terminate_stream && reentrancy_count == 0) {
+    Http2ClientSession *h2_parent = static_cast<Http2ClientSession *>(parent);
+    SCOPED_MUTEX_LOCK(lock, h2_parent->connection_state.mutex, this_ethread());
+    h2_parent->connection_state.delete_stream(this);
+    destroy();
   }
 }
 
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index ed28b54..2261377 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -168,6 +168,7 @@ public:
   VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *abuffer, bool owner = false);
   void do_io_close(int lerrno = -1);
   void initiating_close();
+  void terminate_if_possible();
   void do_io_shutdown(ShutdownHowTo_t) {}
   void update_read_request(int64_t read_len, bool send_update);
   bool update_write_request(IOBufferReader *buf_reader, int64_t write_len, bool send_update);

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].