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

Function synclient_txn_read_response_handler

src/api/InkAPITest.cc:639–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637}
638
639static int
640synclient_txn_read_response_handler(TSCont contp, TSEvent event, void * /* data ATS_UNUSED */)
641{
642 ClientTxn *txn = static_cast<ClientTxn *>(TSContDataGet(contp));
643 TSAssert(txn->magic == MAGIC_ALIVE);
644
645 int64_t avail;
646
647 switch (event) {
648 case TS_EVENT_VCONN_READ_READY:
649 case TS_EVENT_VCONN_READ_COMPLETE:
650 if (event == TS_EVENT_VCONN_READ_READY) {
651 Dbg(dbg_ctl_SockClient, "READ_READY");
652 } else {
653 Dbg(dbg_ctl_SockClient, "READ_COMPLETE");
654 }
655
656 avail = TSIOBufferReaderAvail(txn->resp_reader);
657 Dbg(dbg_ctl_SockClient, "%" PRId64 " bytes available in buffer", avail);
658
659 if (avail > 0) {
660 synclient_txn_read_response(contp);
661 TSIOBufferReaderConsume(txn->resp_reader, avail);
662 }
663
664 TSVIOReenable(txn->read_vio);
665 break;
666
667 case TS_EVENT_VCONN_EOS:
668 Dbg(dbg_ctl_SockClient, "READ_EOS");
669 // Connection closed. In HTTP/1.0 it means we're done for this request.
670 txn->status = REQUEST_SUCCESS;
671 synclient_txn_close(static_cast<ClientTxn *>(TSContDataGet(contp)));
672 TSContDestroy(contp);
673 return 1;
674
675 case TS_EVENT_ERROR:
676 Dbg(dbg_ctl_SockClient, "READ_ERROR");
677 txn->status = REQUEST_FAILURE;
678 synclient_txn_close(static_cast<ClientTxn *>(TSContDataGet(contp)));
679 TSContDestroy(contp);
680 return 1;
681
682 default:
683 TSAssert(!"Invalid event");
684 break;
685 }
686 return 1;
687}
688
689static int
690synclient_txn_write_request(TSCont contp)

Callers

nothing calls this directly

Calls 7

TSContDataGetFunction · 0.85
TSIOBufferReaderAvailFunction · 0.85
TSVIOReenableFunction · 0.85
synclient_txn_closeFunction · 0.85
TSContDestroyFunction · 0.85
TSIOBufferReaderConsumeFunction · 0.70

Tested by

no test coverage detected