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

Function compress_transform_do

plugins/compress/compress.cc:593–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591}
592
593static void
594compress_transform_do(TSCont contp)
595{
596 TSVIO upstream_vio;
597 Data *data;
598 int64_t upstream_todo;
599 int64_t downstream_bytes_written;
600
601 data = static_cast<Data *>(TSContDataGet(contp));
602 if (data->state == transform_state_initialized) {
603 compress_transform_init(contp, data);
604 }
605
606 upstream_vio = TSVConnWriteVIOGet(contp);
607 downstream_bytes_written = data->downstream_length;
608
609 if (!TSVIOBufferGet(upstream_vio)) {
610 compress_transform_finish(data);
611
612 TSVIONBytesSet(data->downstream_vio, data->downstream_length);
613
614 if (data->downstream_length > downstream_bytes_written) {
615 TSVIOReenable(data->downstream_vio);
616 }
617 return;
618 }
619
620 upstream_todo = TSVIONTodoGet(upstream_vio);
621
622 if (upstream_todo > 0) {
623 int64_t upstream_avail = TSIOBufferReaderAvail(TSVIOReaderGet(upstream_vio));
624
625 if (upstream_todo > upstream_avail) {
626 upstream_todo = upstream_avail;
627 }
628
629 if (upstream_todo > 0) {
630 compress_transform_one(data, TSVIOReaderGet(upstream_vio), upstream_todo);
631 TSVIONDoneSet(upstream_vio, TSVIONDoneGet(upstream_vio) + upstream_todo);
632 }
633 }
634
635 if (TSVIONTodoGet(upstream_vio) > 0) {
636 if (upstream_todo > 0) {
637 if (data->downstream_length > downstream_bytes_written) {
638 TSVIOReenable(data->downstream_vio);
639 }
640 TSContCall(TSVIOContGet(upstream_vio), TS_EVENT_VCONN_WRITE_READY, upstream_vio);
641 }
642 } else {
643 compress_transform_finish(data);
644 TSVIONBytesSet(data->downstream_vio, data->downstream_length);
645
646 if (data->downstream_length > downstream_bytes_written) {
647 TSVIOReenable(data->downstream_vio);
648 }
649
650 TSContCall(TSVIOContGet(upstream_vio), TS_EVENT_VCONN_WRITE_COMPLETE, upstream_vio);

Callers 1

compress_transformFunction · 0.85

Calls 15

TSContDataGetFunction · 0.85
compress_transform_initFunction · 0.85
TSVConnWriteVIOGetFunction · 0.85
TSVIOBufferGetFunction · 0.85
TSVIONBytesSetFunction · 0.85
TSVIOReenableFunction · 0.85
TSVIONTodoGetFunction · 0.85
TSIOBufferReaderAvailFunction · 0.85
TSVIOReaderGetFunction · 0.85
compress_transform_oneFunction · 0.85
TSVIONDoneSetFunction · 0.85

Tested by

no test coverage detected