| 637 | } |
| 638 | |
| 639 | static int |
| 640 | synclient_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 | |
| 689 | static int |
| 690 | synclient_txn_write_request(TSCont contp) |
nothing calls this directly
no test coverage detected