| 119 | } |
| 120 | |
| 121 | int |
| 122 | handlePost(TSCont c, TSEvent e, [[maybe_unused]] void *data) |
| 123 | { |
| 124 | assert(c != nullptr); |
| 125 | // TODO(dmorilha): assert on possible events. |
| 126 | PostState *const state = static_cast<PostState *>(TSContDataGet(c)); |
| 127 | assert(state != nullptr); |
| 128 | if (TSVConnClosedGet(c)) { |
| 129 | assert(data != nullptr); |
| 130 | if (state->clone_reader != nullptr) { |
| 131 | addBody(state->requests, state->clone_reader); |
| 132 | } |
| 133 | dispatch(state->requests, timeout); |
| 134 | delete state; |
| 135 | TSContDataSet(c, nullptr); |
| 136 | TSContDestroy(c); |
| 137 | return 0; |
| 138 | } else { |
| 139 | switch (e) { |
| 140 | case TS_EVENT_ERROR: { |
| 141 | const TSVIO vio = TSVConnWriteVIOGet(c); |
| 142 | assert(vio != nullptr); |
| 143 | TSContCall(TSVIOContGet(vio), TS_EVENT_ERROR, vio); |
| 144 | } break; |
| 145 | case TS_EVENT_VCONN_WRITE_COMPLETE: |
| 146 | TSVConnShutdown(TSTransformOutputVConnGet(c), 0, 1); |
| 147 | break; |
| 148 | |
| 149 | case TS_EVENT_VCONN_WRITE_READY: |
| 150 | default: |
| 151 | postTransform(c, *state); |
| 152 | break; |
| 153 | } |
| 154 | } |
| 155 | return 0; |
| 156 | } |
nothing calls this directly
no test coverage detected