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

Function handle_accept

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

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

Source from the content-addressed store, hash-verified

181
182//----------------------------------------------------------------------------
183static int
184handle_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//----------------------------------------------------------------------------
214static void

Callers 1

cache_interceptFunction · 0.85

Calls 7

TSContDataGetFunction · 0.85
TSIOBufferCreateFunction · 0.85
TSIOBufferReaderAllocFunction · 0.85
TSVConnReadFunction · 0.85
TSVConnCloseFunction · 0.85
TSContDestroyFunction · 0.85
TSfreeFunction · 0.85

Tested by

no test coverage detected