----------------------------------------------------------------------------
| 181 | |
| 182 | //---------------------------------------------------------------------------- |
| 183 | static int |
| 184 | handle_accept(TSCont contp, TSEvent event, TSVConn vc) |
| 185 | { |
| 186 | cache_scan_state *cstate = static_cast<cache_scan_state *>(TSContDataGet(contp)); |
| 187 | |
| 188 | if (event == TS_EVENT_NET_ACCEPT) { |
| 189 | if (cstate) { |
| 190 | // setup vc, buffers |
| 191 | cstate->net_vc = vc; |
| 192 | |
| 193 | cstate->req_buffer = TSIOBufferCreate(); |
| 194 | cstate->resp_buffer = TSIOBufferCreate(); |
| 195 | cstate->resp_reader = TSIOBufferReaderAlloc(cstate->resp_buffer); |
| 196 | |
| 197 | cstate->read_vio = TSVConnRead(cstate->net_vc, contp, cstate->req_buffer, INT64_MAX); |
| 198 | } else { |
| 199 | TSVConnClose(vc); |
| 200 | TSContDestroy(contp); |
| 201 | } |
| 202 | } else { |
| 203 | // net_accept failed |
| 204 | if (cstate) { |
| 205 | TSfree(cstate); |
| 206 | } |
| 207 | TSContDestroy(contp); |
| 208 | } |
| 209 | |
| 210 | return 0; |
| 211 | } |
| 212 | |
| 213 | //---------------------------------------------------------------------------- |
| 214 | static void |
no test coverage detected