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

Method process_read_side

src/proxy/PluginVC.cc:601–639  ·  view source on GitHub ↗

void PluginVC::process_read_side() This function may only be called while holding this->mutex & while it is ok to callback the read side continuation Closes read state if other side write state is no longer available

Source from the content-addressed store, hash-verified

599// write state is no longer available
600//
601void
602PluginVC::process_read_side()
603{
604 ink_assert(!deletable);
605 ink_assert(magic == PLUGIN_VC_MAGIC_ALIVE);
606
607 Dbg(dbg_ctl_pvc, "[%u] %s: process_read_side", core_obj->id, PVC_TYPE);
608 need_read_process = false;
609
610 // Check read_state
611 if (read_state.vio.cont == nullptr || read_state.vio.op != VIO::READ || closed || read_state.shutdown ||
612 !read_state.vio.ntodo()) {
613 return;
614 }
615
616 if (!other_side->closed && !other_side->write_state.shutdown) {
617 if (other_side->write_state.vio.op != VIO::WRITE || other_side->write_state.shutdown) {
618 // Just return, no touch on `other_side->need_write_process`.
619 return;
620 }
621 // Acquire the lock of the write side continuation
622 EThread *my_ethread = mutex->thread_holding;
623 ink_assert(my_ethread != nullptr);
624 MUTEX_TRY_LOCK(lock, other_side->write_state.vio.mutex, my_ethread);
625 if (!lock.is_locked()) {
626 Dbg(dbg_ctl_pvc_event, "[%u] %s: process_write_side from other side lock miss, retrying", other_side->core_obj->id,
627 ((other_side->vc_type == PLUGIN_VC_ACTIVE) ? "Active" : "Passive"));
628
629 // set need_write_process to enforce the write processing
630 other_side->need_write_process = true;
631 other_side->setup_event_cb(PVC_LOCK_RETRY_TIME, &other_side->core_lock_retry_event);
632 return;
633 }
634 other_side->process_write_side();
635 } else {
636 Dbg(dbg_ctl_pvc, "[%u] %s: write_state of other side is not available", core_obj->id, PVC_TYPE);
637 read_state.vio.cont->handleEvent(VC_EVENT_EOS, &read_state.vio);
638 }
639}
640
641// void PluginVC::process_read_close()
642//

Callers

nothing calls this directly

Calls 4

ntodoMethod · 0.80
setup_event_cbMethod · 0.80
process_write_sideMethod · 0.80
handleEventMethod · 0.45

Tested by

no test coverage detected