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

Function dump_psi

example/plugins/c-api/thread_pool/psi.cc:694–723  ·  view source on GitHub ↗

------------------------------------------------------------------------- dump_psi Dump the psi_output to the downstream vconnection. Input: contp continuation for the current transaction Output : Return Value: 0 if failure 1 if success -------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

692 1 if success
693 -------------------------------------------------------------------------*/
694static int
695dump_psi(TSCont contp)
696{
697 ContData *data;
698
699 data = contDataGet(contp);
700 TSAssert(data->magic == MAGIC_ALIVE);
701
702 /* If script exec succeeded, copy its output to the downstream vconn */
703 if (data->psi_success == 1) {
704 int psi_output_len = TSIOBufferReaderAvail(data->psi_reader);
705
706 if (psi_output_len > 0) {
707 data->transform_bytes += psi_output_len;
708
709 Dbg(dbg_ctl, "Inserting %d bytes from include file", psi_output_len);
710 /* TODO: Should we check the return value of TSIOBufferCopy() ? */
711 TSIOBufferCopy(TSVIOBufferGet(data->output_vio), data->psi_reader, psi_output_len, 0);
712 /* Consume all the output data */
713 TSIOBufferReaderConsume(data->psi_reader, psi_output_len);
714
715 /* Reenable the output connection so it can read the data we've produced. */
716 TSVIOReenable(data->output_vio);
717 }
718 }
719
720 /* Change state to finish up reading upstream data */
721 data->state = STATE_READ_DATA;
722 return 0;
723}
724
725/*-------------------------------------------------------------------------
726 transform_handler

Callers 1

transform_handlerFunction · 0.85

Calls 6

contDataGetFunction · 0.85
TSIOBufferReaderAvailFunction · 0.85
TSIOBufferCopyFunction · 0.85
TSVIOBufferGetFunction · 0.85
TSVIOReenableFunction · 0.85
TSIOBufferReaderConsumeFunction · 0.50

Tested by

no test coverage detected