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

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  80d8653   TS-4483: Simplify NetAccept and SSLNetAccept.
80d8653 is described below

commit 80d865300794e70b828ba04330d732503b2ea5f1
Author: Oknet Xu <[email protected]>
AuthorDate: Thu Jun 23 14:37:39 2016 +0800

    TS-4483: Simplify NetAccept and SSLNetAccept.
    
    Replace getEtype() with member etype. NetAccept has a member named
    'etype' and it is set by upgradeEtype before NetAccept running.
    Thus, we can replace getEtype() with member etype and make the
    SSLNetAccept codes clearly.
    
    This closes #734.
---
 iocore/net/P_SSLNetAccept.h |  5 -----
 iocore/net/SSLNetAccept.cc  | 40 ----------------------------------------
 iocore/net/UnixNetAccept.cc |  8 +++++---
 3 files changed, 5 insertions(+), 48 deletions(-)

diff --git a/iocore/net/P_SSLNetAccept.h b/iocore/net/P_SSLNetAccept.h
index ff8bbad..c20e917 100644
--- a/iocore/net/P_SSLNetAccept.h
+++ b/iocore/net/P_SSLNetAccept.h
@@ -43,17 +43,12 @@
 #include "P_Connection.h"
 #include "P_NetAccept.h"
 
-class Event;
-class UnixNetVConnection;
-
 //
 // NetAccept
 // Handles accepting connections.
 //
 struct SSLNetAccept : public NetAccept {
   virtual NetProcessor *getNetProcessor() const;
-  virtual EventType getEtype() const;
-  virtual void init_accept_per_thread(bool isTransparent);
   virtual NetAccept *clone() const;
 
   SSLNetAccept(){};
diff --git a/iocore/net/SSLNetAccept.cc b/iocore/net/SSLNetAccept.cc
index 47d8b1c..8d6a5c7 100644
--- a/iocore/net/SSLNetAccept.cc
+++ b/iocore/net/SSLNetAccept.cc
@@ -22,52 +22,12 @@
 #include "ts/ink_config.h"
 #include "P_Net.h"
 
-typedef int (SSLNetAccept::*SSLNetAcceptHandler)(int, void *);
-
-// Virtual function allows the correct
-// etype to be used in NetAccept functions (ET_SSL
-// or ET_NET).
-EventType
-SSLNetAccept::getEtype() const
-{
-  return SSLNetProcessor::ET_SSL;
-}
-
 NetProcessor *
 SSLNetAccept::getNetProcessor() const
 {
   return &sslNetProcessor;
 }
 
-void
-SSLNetAccept::init_accept_per_thread(bool isTransparent)
-{
-  int i, n;
-  NetAccept *a;
-
-  if (do_listen(NON_BLOCKING, isTransparent))
-    return;
-  if (accept_fn == net_accept)
-    SET_HANDLER((SSLNetAcceptHandler)&SSLNetAccept::acceptFastEvent);
-  else
-    SET_HANDLER((SSLNetAcceptHandler)&SSLNetAccept::acceptEvent);
-  period = -HRTIME_MSECONDS(net_accept_period);
-  n      = eventProcessor.n_threads_for_type[SSLNetProcessor::ET_SSL];
-  for (i = 0; i < n; i++) {
-    if (i < n - 1)
-      a = clone();
-    else
-      a        = this;
-    EThread *t = eventProcessor.eventthread[SSLNetProcessor::ET_SSL][i];
-
-    PollDescriptor *pd = get_PollDescriptor(t);
-    if (ep.start(pd, this, EVENTIO_READ) < 0)
-      Debug("iocore_net", "error starting EventIO");
-    a->mutex = get_NetHandler(t)->mutex;
-    t->schedule_every(a, period, etype);
-  }
-}
-
 NetAccept *
 SSLNetAccept::clone() const
 {
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index d70a276..dc6157d 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -181,6 +181,8 @@ NetAccept::init_accept_per_thread(bool isTransparent)
 {
   int i, n;
 
+  ink_assert(etype >= 0);
+
   if (do_listen(NON_BLOCKING, isTransparent))
     return;
 
@@ -190,7 +192,7 @@ NetAccept::init_accept_per_thread(bool isTransparent)
     SET_HANDLER((NetAcceptHandler)&NetAccept::acceptEvent);
 
   period = -HRTIME_MSECONDS(net_accept_period);
-  n      = eventProcessor.n_threads_for_type[ET_NET];
+  n      = eventProcessor.n_threads_for_type[etype];
 
   for (i = 0; i < n; i++) {
     NetAccept *a;
@@ -201,7 +203,7 @@ NetAccept::init_accept_per_thread(bool isTransparent)
       a = this;
     }
 
-    EThread *t         = eventProcessor.eventthread[ET_NET][i];
+    EThread *t         = eventProcessor.eventthread[etype][i];
     PollDescriptor *pd = get_PollDescriptor(t);
 
     if (a->ep.start(pd, a, EVENTIO_READ) < 0)
@@ -304,7 +306,7 @@ NetAccept::do_blocking_accept(EThread *t)
     vc->action_ = *action_;
     SET_CONTINUATION_HANDLER(vc, 
(NetVConnHandler)&UnixNetVConnection::acceptEvent);
     // eventProcessor.schedule_imm(vc, getEtype());
-    eventProcessor.schedule_imm_signal(vc, getEtype());
+    eventProcessor.schedule_imm_signal(vc, etype);
   } while (loop);
 
   return 1;

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to