MCPcopy Create free account
hub / github.com/apache/trafficserver / synclient_txn_write_request

Function synclient_txn_write_request

src/api/InkAPITest.cc:689–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687}
688
689static int
690synclient_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
720static int
721synclient_txn_write_request_handler(TSCont contp, TSEvent event, void * /* data ATS_UNUSED */)

Callers 1

Calls 6

TSContDataGetFunction · 0.85
TSIOBufferStartFunction · 0.85
TSIOBufferProduceFunction · 0.85
TSVConnWriteFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected