You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/03/01 00:25:14 UTC

[GitHub] [trafficserver] SolidWallOfCode commented on a change in pull request #8698: WIP: Remove intermediate buffer in PluginVC

SolidWallOfCode commented on a change in pull request #8698:
URL: https://github.com/apache/trafficserver/pull/8698#discussion_r816355064



##########
File path: proxy/PluginVC.cc
##########
@@ -507,69 +506,63 @@ PluginVC::process_write_side(bool other_side_call)
     }
     return;
   }
-  // Bytes available, try to transfer to the PluginVCCore
-  //   intermediate buffer
-  //
-  int64_t buf_space = core_obj->buffer_size - core_buffer->max_read_avail();
+
+  // Other side read_state is open
+  //  obtain the proper mutexes on other side
+  EThread *my_ethread = mutex->thread_holding;
+  ink_assert(my_ethread != nullptr);
+  MUTEX_TRY_LOCK(lock, other_side->read_state.vio.mutex, my_ethread);
+  if (!lock.is_locked()) {
+    Debug("pvc_event", "[%u] %s: process_read_side from other side lock miss, retrying", other_side->core_obj->id,
+          ((other_side->vc_type == PLUGIN_VC_ACTIVE) ? "Active" : "Passive"));
+
+    // set need_read_process to enforce the read processing
+    other_side->need_read_process = true;
+    other_side->setup_event_cb(PVC_LOCK_RETRY_TIME, &other_side->core_lock_retry_event);
+    return;
+  }
+
+  // Bytes available, setting up other side read state writer
+  MIOBuffer *output_buffer = other_side->read_state.vio.get_writer();
+  int64_t water_mark       = output_buffer->water_mark;
+  water_mark               = std::max(water_mark, static_cast<int64_t>(core_obj->buffer_size));

Review comment:
       This might be cleaner as
   ```
   water_mark = std::max<int64_t>(water_mark, core_obj->buffer_size);
   ```
   




-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org