This is an automated email from the ASF dual-hosted git repository.

acanary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b47f90  Accept handling VIO events (#6763)
0b47f90 is described below

commit 0b47f900124c23908c3ea938b1deb62226dd3c4c
Author: a-a-ron <acan...@verizonmedia.com>
AuthorDate: Wed May 13 09:36:45 2020 -0500

    Accept handling VIO events (#6763)
    
    Keeping the VIO continuation set at all times to prevent connection leakage.
---
 proxy/ProtocolProbeSessionAccept.cc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/proxy/ProtocolProbeSessionAccept.cc 
b/proxy/ProtocolProbeSessionAccept.cc
index ed23291..d2fd1ca 100644
--- a/proxy/ProtocolProbeSessionAccept.cc
+++ b/proxy/ProtocolProbeSessionAccept.cc
@@ -66,7 +66,8 @@ struct ProtocolProbeTrampoline : public Continuation, public 
ProtocolProbeSessio
   {
     VIO *vio;
     NetVConnection *netvc;
-    ProtoGroupKey key = N_PROTO_GROUPS; // use this as an invalid value.
+    SessionAccept *acceptor = nullptr;
+    ProtoGroupKey key       = N_PROTO_GROUPS; // use this as an invalid value.
 
     vio   = static_cast<VIO *>(edata);
     netvc = static_cast<NetVConnection *>(vio->vc_server);
@@ -136,15 +137,17 @@ struct ProtocolProbeTrampoline : public Continuation, 
public ProtocolProbeSessio
       key = PROTO_HTTP;
     }
 
-    netvc->do_io_read(nullptr, 0, nullptr); // Disable the read IO that we 
started.
-
-    if (probeParent->endpoint[key] == nullptr) {
+    acceptor = probeParent->endpoint[key];
+    if (acceptor == nullptr) {
       Warning("Unregistered protocol type %d", key);
       goto done;
     }
 
+    // Disable the read IO that we started.
+    netvc->do_io_read(acceptor, 0, nullptr);
+
     // Directly invoke the session acceptor, letting it take ownership of the 
input buffer.
-    if (!probeParent->endpoint[key]->accept(netvc, this->iobuf, reader)) {
+    if (!acceptor->accept(netvc, this->iobuf, reader)) {
       // IPAllow check fails in XxxSessionAccept::accept() if false returned.
       goto done;
     }
@@ -181,7 +184,7 @@ ProtocolProbeSessionAccept::mainEvent(int event, void *data)
       vio->reenable();
     } else {
       Debug("http", "probe already has data, call ioComplete directly..");
-      vio = netvc->do_io_read(nullptr, 0, nullptr);
+      vio = netvc->do_io_read(this, 0, nullptr);
       probe->ioCompletionEvent(VC_EVENT_READ_COMPLETE, (void *)vio);
     }
     return EVENT_CONT;

Reply via email to