| 64 | } |
| 65 | |
| 66 | int |
| 67 | sessionHandler(TSCont continuation, TSEvent event, void *d) |
| 68 | { |
| 69 | TSHttpTxn txnp = static_cast<TSHttpTxn>(d); |
| 70 | TSCont txn_contp; |
| 71 | |
| 72 | switch (event) { |
| 73 | case TS_EVENT_HTTP_PRE_REMAP: { |
| 74 | Dbg(dbg_ctl, " -- sessionHandler :: TS_EVENT_HTTP_PRE_REMAP"); |
| 75 | txn_contp = TSContCreate(transactionHandler, nullptr); |
| 76 | |
| 77 | /* Registers locally to hook PRE_REMAP_HOOK and TXN_CLOSE */ |
| 78 | TSHttpTxnHookAdd(txnp, TS_HTTP_PRE_REMAP_HOOK, txn_contp); |
| 79 | TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, txn_contp); |
| 80 | } break; |
| 81 | |
| 82 | case TS_EVENT_HTTP_SSN_CLOSE: { |
| 83 | Dbg(dbg_ctl, " -- sessionHandler :: TS_EVENT_HTTP_SSN_CLOSE"); |
| 84 | const TSHttpSsn session = static_cast<TSHttpSsn>(d); |
| 85 | |
| 86 | TSHttpSsnReenable(session, TS_EVENT_HTTP_CONTINUE); |
| 87 | TSContDestroy(continuation); |
| 88 | return 0; |
| 89 | } break; |
| 90 | |
| 91 | case TS_EVENT_TIMEOUT: { // The schedule case, reenable the session continuation |
| 92 | Dbg(dbg_ctl, " -- sessionHandler :: TS_EVENT_TIMEOUT"); |
| 93 | TSHttpSsn session = static_cast<TSHttpSsn>(TSContDataGet(continuation)); |
| 94 | TSHttpSsnReenable(session, TS_EVENT_HTTP_CONTINUE); |
| 95 | return 0; |
| 96 | } |
| 97 | default: |
| 98 | TSAssert(!"Unexpected event"); |
| 99 | break; |
| 100 | } |
| 101 | |
| 102 | TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE); |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | int |
| 107 | globalHandler(TSCont /* continuation ATS_UNUSED */, TSEvent event, void *data) |
nothing calls this directly
no test coverage detected