| 718 | } |
| 719 | |
| 720 | static int |
| 721 | synclient_txn_write_request_handler(TSCont contp, TSEvent event, void * /* data ATS_UNUSED */) |
| 722 | { |
| 723 | ClientTxn *txn = static_cast<ClientTxn *>(TSContDataGet(contp)); |
| 724 | TSAssert(txn->magic == MAGIC_ALIVE); |
| 725 | |
| 726 | switch (event) { |
| 727 | case TS_EVENT_VCONN_WRITE_READY: |
| 728 | Dbg(dbg_ctl_SockClient, "WRITE_READY"); |
| 729 | TSVIOReenable(txn->write_vio); |
| 730 | break; |
| 731 | |
| 732 | case TS_EVENT_VCONN_WRITE_COMPLETE: |
| 733 | Dbg(dbg_ctl_SockClient, "WRITE_COMPLETE"); |
| 734 | // Weird: synclient should not close the write part of vconn. |
| 735 | // Otherwise some strangeness... |
| 736 | |
| 737 | /* Start reading */ |
| 738 | SET_TEST_HANDLER(txn->current_handler, synclient_txn_read_response_handler); |
| 739 | txn->read_vio = TSVConnRead(txn->vconn, contp, txn->resp_buffer, INT64_MAX); |
| 740 | break; |
| 741 | |
| 742 | case TS_EVENT_VCONN_EOS: |
| 743 | Dbg(dbg_ctl_SockClient, "WRITE_EOS"); |
| 744 | txn->status = REQUEST_FAILURE; |
| 745 | synclient_txn_close(static_cast<ClientTxn *>(TSContDataGet(contp))); |
| 746 | TSContDestroy(contp); |
| 747 | break; |
| 748 | |
| 749 | case TS_EVENT_ERROR: |
| 750 | Dbg(dbg_ctl_SockClient, "WRITE_ERROR"); |
| 751 | txn->status = REQUEST_FAILURE; |
| 752 | synclient_txn_close(static_cast<ClientTxn *>(TSContDataGet(contp))); |
| 753 | TSContDestroy(contp); |
| 754 | break; |
| 755 | |
| 756 | default: |
| 757 | TSAssert(!"Invalid event"); |
| 758 | break; |
| 759 | } |
| 760 | return TS_EVENT_IMMEDIATE; |
| 761 | } |
| 762 | |
| 763 | static int |
| 764 | synclient_txn_connect_handler(TSCont contp, TSEvent event, void *data) |
nothing calls this directly
no test coverage detected