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 2020/01/06 22:39:12 UTC

[trafficserver] 02/02: Add in_destroy to Http2ConnectionState to prevent double delete (similar to Http2ClientSession)

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

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

commit ad1fa77fce656fe3d7d993a336ae446a80c96c3c
Author: Sudheer Vinukonda <su...@apache.org>
AuthorDate: Mon Aug 26 20:21:20 2019 -0700

    Add in_destroy to Http2ConnectionState to prevent
    double delete (similar to Http2ClientSession)
    
    Add zombie_event when destroy() is called more than once.
    
    (cherry picked from commit e894d18608ec371d2b8976ad131b9f2cd0b2e832)
---
 proxy/http2/Http2ConnectionState.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h
index 3f49fa1..f68db97 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -140,6 +140,11 @@ public:
   void
   destroy()
   {
+    if (in_destroy) {
+      schedule_zombie_event();
+      return;
+    }
+    in_destroy = true;
     if (shutdown_cont_event) {
       shutdown_cont_event->cancel();
       shutdown_cont_event = nullptr;
@@ -375,6 +380,7 @@ private:
   Http2StreamId continued_stream_id = 0;
   bool _scheduled                   = false;
   bool fini_received                = false;
+  bool in_destroy                   = false;
   int recursion                     = 0;
   Http2ShutdownState shutdown_state = HTTP2_SHUTDOWN_NONE;
   Http2ErrorCode shutdown_reason    = Http2ErrorCode::HTTP2_ERROR_MAX;