bneradt commented on code in PR #10964:
URL: https://github.com/apache/trafficserver/pull/10964#discussion_r1442213828


##########
plugins/multiplexer/post.cc:
##########
@@ -48,55 +52,65 @@ postTransform(const TSCont c, PostState &s)
 {
   assert(c != nullptr);
 
-  const TSVConn vconnection = TSTransformOutputVConnGet(c);
-  assert(vconnection != nullptr);
+  // As we collect data from the client, we need to write it to the origin. 
This
+  // is for the original origin. The copies are handled via HttpTransaction
+  // logic in fetcher.h.
+  const TSVConn output_vconn = TSTransformOutputVConnGet(c);
+  assert(output_vconn != nullptr);
 
-  const TSVIO vio = TSVConnWriteVIOGet(c);
-  assert(vio != nullptr);
+  // The VIO from which we pull out the client's request.
+  const TSVIO input_vio = TSVConnWriteVIOGet(c);
+  assert(input_vio != nullptr);
 
-  if (!s.buffer) {
-    s.buffer = TSIOBufferCreate();
-    assert(s.buffer != nullptr);
+  if (!s.origin_buffer) {
+    s.origin_buffer = TSIOBufferCreate();
+    assert(s.origin_buffer != nullptr);
 
-    const TSIOBufferReader reader = TSIOBufferReaderAlloc(s.buffer);
-    assert(reader != nullptr);
+    TSIOBufferReader origin_reader = TSIOBufferReaderAlloc(s.origin_buffer);
+    assert(origin_reader != nullptr);
 
-    s.reader = TSIOBufferReaderClone(reader);
-    assert(s.reader != nullptr);
+    s.clone_reader = TSIOBufferReaderClone(origin_reader);
+    assert(s.clone_reader != nullptr);
 
-    s.vio = TSVConnWrite(vconnection, c, reader, 
std::numeric_limits<int64_t>::max());
-    assert(s.vio != nullptr);
+    s.output_vio = TSVConnWrite(output_vconn, c, origin_reader, 
std::numeric_limits<int64_t>::max());
+    assert(s.output_vio != nullptr);
   }
 
-  if (!TSVIOBufferGet(vio)) {
-    TSVIONBytesSet(s.vio, TSVIONDoneGet(vio));
-    TSVIOReenable(s.vio);
+  if (!TSVIOBufferGet(input_vio)) {
+    if (s.output_vio) {

Review Comment:
   This is the only "interesting" change in this PR in which I add a nullptr 
check just in case.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to