| 1085 | } |
| 1086 | |
| 1087 | static int |
| 1088 | synserver_txn_read_request_handler(TSCont contp, TSEvent event, void * /* data ATS_UNUSED */) |
| 1089 | { |
| 1090 | ServerTxn *txn = static_cast<ServerTxn *>(TSContDataGet(contp)); |
| 1091 | TSAssert(txn->magic == MAGIC_ALIVE); |
| 1092 | |
| 1093 | int64_t avail; |
| 1094 | int end_of_request; |
| 1095 | |
| 1096 | switch (event) { |
| 1097 | case TS_EVENT_VCONN_READ_READY: |
| 1098 | case TS_EVENT_VCONN_READ_COMPLETE: |
| 1099 | Dbg(dbg_ctl_SockServer, (event == TS_EVENT_VCONN_READ_READY) ? "READ_READY" : "READ_COMPLETE"); |
| 1100 | avail = TSIOBufferReaderAvail(txn->req_reader); |
| 1101 | Dbg(dbg_ctl_SockServer, "%" PRId64 " bytes available in buffer", avail); |
| 1102 | |
| 1103 | if (avail > 0) { |
| 1104 | end_of_request = synserver_txn_read_request(contp); |
| 1105 | TSIOBufferReaderConsume(txn->req_reader, avail); |
| 1106 | |
| 1107 | if (end_of_request) { |
| 1108 | TSVConnShutdown(txn->vconn, 1, 0); |
| 1109 | return synserver_txn_write_response(contp); |
| 1110 | } |
| 1111 | } |
| 1112 | |
| 1113 | TSVIOReenable(txn->read_vio); |
| 1114 | break; |
| 1115 | |
| 1116 | case TS_EVENT_VCONN_EOS: |
| 1117 | Dbg(dbg_ctl_SockServer, "READ_EOS"); |
| 1118 | return synserver_txn_close(contp); |
| 1119 | break; |
| 1120 | |
| 1121 | case TS_EVENT_ERROR: |
| 1122 | Dbg(dbg_ctl_SockServer, "READ_ERROR"); |
| 1123 | return synserver_txn_close(contp); |
| 1124 | break; |
| 1125 | |
| 1126 | default: |
| 1127 | TSAssert(!"Invalid event"); |
| 1128 | break; |
| 1129 | } |
| 1130 | return TS_EVENT_IMMEDIATE; |
| 1131 | } |
| 1132 | |
| 1133 | static int |
| 1134 | synserver_txn_main_handler(TSCont contp, TSEvent event, void *data) |
nothing calls this directly
no test coverage detected