| 687 | } |
| 688 | |
| 689 | static int |
| 690 | synclient_txn_write_request(TSCont contp) |
| 691 | { |
| 692 | ClientTxn *txn = static_cast<ClientTxn *>(TSContDataGet(contp)); |
| 693 | TSAssert(txn->magic == MAGIC_ALIVE); |
| 694 | |
| 695 | TSIOBufferBlock block; |
| 696 | char *ptr_block; |
| 697 | int64_t len, ndone, ntodo, towrite, avail; |
| 698 | |
| 699 | len = strlen(txn->request); |
| 700 | |
| 701 | ndone = 0; |
| 702 | ntodo = len; |
| 703 | while (ntodo > 0) { |
| 704 | block = TSIOBufferStart(txn->req_buffer); |
| 705 | ptr_block = TSIOBufferBlockWriteStart(block, &avail); |
| 706 | towrite = std::min(ntodo, avail); |
| 707 | memcpy(ptr_block, txn->request + ndone, towrite); |
| 708 | TSIOBufferProduce(txn->req_buffer, towrite); |
| 709 | ntodo -= towrite; |
| 710 | ndone += towrite; |
| 711 | } |
| 712 | |
| 713 | /* Start writing the response */ |
| 714 | Dbg(dbg_ctl_SockClient, "Writing |%s| (%" PRId64 ") bytes", txn->request, len); |
| 715 | txn->write_vio = TSVConnWrite(txn->vconn, contp, txn->req_reader, len); |
| 716 | |
| 717 | return 1; |
| 718 | } |
| 719 | |
| 720 | static int |
| 721 | synclient_txn_write_request_handler(TSCont contp, TSEvent event, void * /* data ATS_UNUSED */) |
no test coverage detected