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/08/16 16:09:10 UTC

[trafficserver] branch master updated: Metalink Plugin: Must not destroy the Transform Contp, only shutdown write on it while received WRITE_COMPLETE

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 e115703  Metalink Plugin: Must not destroy the Transform Contp, only shutdown write on it while received WRITE_COMPLETE
e115703 is described below

commit e1157033d260f62711bce157e8649816b00f0369
Author: Oknet Xu <xu...@skyguard.com.cn>
AuthorDate: Mon Mar 6 18:47:11 2017 +0800

    Metalink Plugin: Must not destroy the Transform Contp, only shutdown write on it while received WRITE_COMPLETE
    
    The transform contp will be closed and destroied after TransformVC is closed.
    The transformation plugin receives EVENT_IMMEDIATE when transform contp close
    then the plugin could release 'TransformData' and call TSContDestroy().
---
 plugins/experimental/metalink/metalink.cc | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/plugins/experimental/metalink/metalink.cc b/plugins/experimental/metalink/metalink.cc
index 052e1bf..95ccfd0 100644
--- a/plugins/experimental/metalink/metalink.cc
+++ b/plugins/experimental/metalink/metalink.cc
@@ -464,8 +464,7 @@ vconn_write_ready(TSCont contp, void * /* edata ATS_UNUSED */)
 
     /* Can't reuse the TSTransformCreate() continuation because we
      * don't know whether to destroy it in
-     * cache_open_write()/cache_open_write_failed() or
-     * transform_vconn_write_complete() */
+     * cache_open_write()/cache_open_write_failed() */
     contp = TSContCreate(write_handler, nullptr);
     TSContDataSet(contp, write_data);
 
@@ -476,18 +475,6 @@ vconn_write_ready(TSCont contp, void * /* edata ATS_UNUSED */)
   return 0;
 }
 
-static int
-transform_vconn_write_complete(TSCont contp, void * /* edata ATS_UNUSED */)
-{
-  TransformData *data = (TransformData *)TSContDataGet(contp);
-  TSContDestroy(contp);
-
-  TSIOBufferDestroy(data->output_bufp);
-  TSfree(data);
-
-  return 0;
-}
-
 /* TSTransformCreate() handler: Compute the SHA-256 digest of the
  * content */
 
@@ -500,8 +487,8 @@ transform_handler(TSCont contp, TSEvent event, void *edata)
     return vconn_write_ready(contp, edata);
 
   case TS_EVENT_VCONN_WRITE_COMPLETE:
-    return transform_vconn_write_complete(contp, edata);
-
+    TSVConnShutdown(TSTransformOutputVConnGet(contp), 0, 1);
+    break;
   default:
     TSAssert(!"Unexpected event");
   }

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