MCPcopy Create free account
hub / github.com/apache/trafficserver / cleanup

Function cleanup

example/plugins/c-api/cache_scan/cache_scan.cc:214–252  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

212
213//----------------------------------------------------------------------------
214static void
215cleanup(TSCont contp)
216{
217 // shutdown vc and free memory
218 cache_scan_state *cstate = static_cast<cache_scan_state *>(TSContDataGet(contp));
219
220 if (cstate) {
221 // cancel any pending cache scan actions, since we will be destroying the
222 // continuation
223 if (cstate->pending_action) {
224 TSActionCancel(cstate->pending_action);
225 }
226
227 if (cstate->net_vc) {
228 TSVConnShutdown(cstate->net_vc, 1, 1);
229 }
230
231 if (cstate->req_buffer) {
232 TSIOBufferDestroy(cstate->req_buffer);
233 cstate->req_buffer = nullptr;
234 }
235
236 if (cstate->key_to_delete) {
237 if (TSCacheKeyDestroy(cstate->key_to_delete) == TS_ERROR) {
238 TSError("[%s] Failed to destroy cache key", PLUGIN_NAME);
239 }
240 cstate->key_to_delete = nullptr;
241 }
242
243 if (cstate->resp_buffer) {
244 TSIOBufferDestroy(cstate->resp_buffer);
245 cstate->resp_buffer = nullptr;
246 }
247
248 TSVConnClose(cstate->net_vc);
249 TSfree(cstate);
250 }
251 TSContDestroy(contp);
252}
253
254//----------------------------------------------------------------------------
255static int

Callers 2

handle_ioFunction · 0.70
cache_interceptFunction · 0.70

Calls 9

TSContDataGetFunction · 0.85
TSActionCancelFunction · 0.85
TSVConnShutdownFunction · 0.85
TSIOBufferDestroyFunction · 0.85
TSCacheKeyDestroyFunction · 0.85
TSVConnCloseFunction · 0.85
TSfreeFunction · 0.85
TSContDestroyFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected