| 73 | } |
| 74 | |
| 75 | int |
| 76 | handleTransactionEvents(TSCont cont, TSEvent event, void *edata) |
| 77 | { |
| 78 | // This function is only here to clean up Transaction objects |
| 79 | TSHttpTxn ats_txn_handle = static_cast<TSHttpTxn>(edata); |
| 80 | Transaction &transaction = utils::internal::getTransaction(ats_txn_handle); |
| 81 | LOG_DEBUG("Got event %d on continuation %p for transaction (ats pointer %p, object %p)", event, cont, ats_txn_handle, |
| 82 | &transaction); |
| 83 | |
| 84 | utils::internal::setTransactionEvent(transaction, event); |
| 85 | switch (event) { |
| 86 | case TS_EVENT_HTTP_POST_REMAP: |
| 87 | // This is here to force a refresh of the cached client request url |
| 88 | TSMBuffer hdr_buf; |
| 89 | TSMLoc hdr_loc; |
| 90 | (void)TSHttpTxnClientReqGet(static_cast<TSHttpTxn>(transaction.getAtsHandle()), &hdr_buf, &hdr_loc); |
| 91 | break; |
| 92 | case TS_EVENT_HTTP_SEND_REQUEST_HDR: |
| 93 | case TS_EVENT_HTTP_READ_RESPONSE_HDR: |
| 94 | case TS_EVENT_HTTP_SEND_RESPONSE_HDR: |
| 95 | case TS_EVENT_HTTP_READ_CACHE_HDR: |
| 96 | // the buffer handles may be destroyed in the core during redirect follow |
| 97 | resetTransactionHandles(transaction, event); |
| 98 | break; |
| 99 | case TS_EVENT_HTTP_TXN_CLOSE: { // opening scope to declare plugins variable below |
| 100 | resetTransactionHandles(transaction, event); |
| 101 | const std::list<TransactionPlugin *> &plugins = utils::internal::getTransactionPlugins(transaction); |
| 102 | for (auto plugin : plugins) { |
| 103 | cleanupTransactionPlugin(plugin, ats_txn_handle); |
| 104 | } |
| 105 | cleanupTransaction(transaction, ats_txn_handle); |
| 106 | } break; |
| 107 | default: |
| 108 | assert(false); /* we should never get here */ |
| 109 | break; |
| 110 | } |
| 111 | TSHttpTxnReenable(ats_txn_handle, TS_EVENT_HTTP_CONTINUE); |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | void |
| 116 | setupTransactionManagement() |
nothing calls this directly
no test coverage detected