This function starts to read incoming client request data from client_vc */
| 152 | |
| 153 | /* This function starts to read incoming client request data from client_vc */ |
| 154 | int |
| 155 | state_start(TSCont contp, TSEvent event ATS_UNUSED, void *data ATS_UNUSED) |
| 156 | { |
| 157 | TxnSM *txn_sm = static_cast<TxnSM *>(TSContDataGet(contp)); |
| 158 | |
| 159 | if (!txn_sm->q_client_vc) { |
| 160 | return prepare_to_die(contp); |
| 161 | } |
| 162 | |
| 163 | txn_sm->q_client_request_buffer = TSIOBufferCreate(); |
| 164 | if (!txn_sm->q_client_request_buffer) { |
| 165 | return prepare_to_die(contp); |
| 166 | } |
| 167 | txn_sm->q_client_request_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_client_request_buffer); |
| 168 | if (!txn_sm->q_client_request_buffer_reader) { |
| 169 | return prepare_to_die(contp); |
| 170 | } |
| 171 | |
| 172 | /* Now the IOBuffer and IOBufferReader is ready, the data from |
| 173 | client_vc can be read into the IOBuffer. Since we don't know |
| 174 | the size of the client request, set the expecting size to be |
| 175 | INT64_MAX, so that we will always get TS_EVENT_VCONN_READ_READY |
| 176 | event, but never TS_EVENT_VCONN_READ_COMPLETE event. */ |
| 177 | set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_interface_with_client); |
| 178 | txn_sm->q_client_read_vio = TSVConnRead(txn_sm->q_client_vc, contp, txn_sm->q_client_request_buffer, INT64_MAX); |
| 179 | |
| 180 | return TS_SUCCESS; |
| 181 | } |
| 182 | |
| 183 | /* This function is to call proper functions according to the |
| 184 | VIO argument. If it's read_vio, which means reading request from |
nothing calls this directly
no test coverage detected