You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Alan M. Carroll (JIRA)" <ji...@apache.org> on 2016/08/19 19:42:20 UTC

[jira] [Assigned] (TS-4555) C++ API takes a transaction argument without allocating it

     [ https://issues.apache.org/jira/browse/TS-4555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan M. Carroll reassigned TS-4555:
-----------------------------------

    Assignee: Alan M. Carroll  (was: Brian Geffon)

> C++ API takes a transaction argument without allocating it
> ----------------------------------------------------------
>
>                 Key: TS-4555
>                 URL: https://issues.apache.org/jira/browse/TS-4555
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: CPP API
>            Reporter: James Peach
>            Assignee: Alan M. Carroll
>             Fix For: 7.0.0
>
>
> {code}
> Transaction &
> utils::internal::getTransaction(TSHttpTxn ats_txn_handle)
> {
>   Transaction *transaction = static_cast<Transaction *>(TSHttpTxnArgGet(ats_txn_handle, TRANSACTION_STORAGE_INDEX));
>   if (!transaction) {
>     transaction = new Transaction(static_cast<void *>(ats_txn_handle));
>     LOG_DEBUG("Created new transaction object at %p for ats pointer %p", transaction, ats_txn_handle);
>     TSHttpTxnArgSet(ats_txn_handle, TRANSACTION_STORAGE_INDEX, transaction);
>   }
>   return *transaction;
> }
> {code}
> {{TRANSACTION_STORAGE_INDEX}} is hardcoded constant that is not allocated by {{TSHttpArgIndexReserve}}, so it is subject to collisions with other plugins.



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