[ 
https://issues.apache.org/jira/browse/TS-4590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353147#comment-15353147
 ] 

ASF GitHub Bot commented on TS-4590:
------------------------------------

Github user shinrich commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/752#discussion_r68775437
  
    --- Diff: proxy/InkAPI.cc ---
    @@ -1037,43 +1047,36 @@ INKVConnInternal::INKVConnInternal(TSEventFunc 
funcp, TSMutex mutexp)
       : INKContInternal(funcp, mutexp), m_read_vio(), m_write_vio(), 
m_output_vc(NULL)
     {
       m_closed = 0;
    -  SET_HANDLER(&INKVConnInternal::handle_event);
     }
     
     void
    -INKVConnInternal::init(TSEventFunc funcp, TSMutex mutexp)
    +INKVConnInternal::clear()
     {
    -  INKContInternal::init(funcp, mutexp);
    -  SET_HANDLER(&INKVConnInternal::handle_event);
    +  m_read_vio.set_continuation(NULL);
    +  m_write_vio.set_continuation(NULL);
    +  INKContInternal::clear();
     }
     
     void
    -INKVConnInternal::destroy()
    +INKVConnInternal::free()
     {
    -  m_deleted = 1;
    -  if (m_deletable) {
    -    this->mutex = NULL;
    -    m_read_vio.set_continuation(NULL);
    -    m_write_vio.set_continuation(NULL);
    -    INKVConnAllocator.free(this);
    -  }
    +  clear();
    +  this->mutex.clear();
    +  m_free_magic = INKCONT_INTERN_MAGIC_DEAD;
    +  INKVConnAllocator.free(this);
     }
     
    -int
    -INKVConnInternal::handle_event(int event, void *edata)
    --- End diff --
    
    Where did the INKVConnInternal::handle_event go?  Why is it not needed?  Do 
we not worry about destroying InkVConnInternal objects on the stack and leaving 
live references to hit as we unwind the stack? 


> INKVConnInternal didn't set m_free_magic to DEAD as INKContInternal
> -------------------------------------------------------------------
>
>                 Key: TS-4590
>                 URL: https://issues.apache.org/jira/browse/TS-4590
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: TS API
>            Reporter: Oknet Xu
>
> The class INKContInternal is a base class of INKVConnInternal.
> INKVConnInternal rewrite destroy() and handle_event(), but forgot to set 
> m_free_magic to DEAD that is a debug flag.
> I will add 2 methods for INKContInternal and INKVConnInternal:
> - clear()
>   - clear variables
> - free()
>   - call clear() first
>   - call this->mutex.clear();
>   - set m_free_magic
>   - call xxxAllocator.free(this)
> and rewrite destroy to call free().



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to