• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

SSLNetAccept.cc

Go to the documentation of this file.
00001 /** @file
00002 
00003   @section license License
00004 
00005   Licensed to the Apache Software Foundation (ASF) under one
00006   or more contributor license agreements.  See the NOTICE file
00007   distributed with this work for additional information
00008   regarding copyright ownership.  The ASF licenses this file
00009   to you under the Apache License, Version 2.0 (the
00010   "License"); you may not use this file except in compliance
00011   with the License.  You may obtain a copy of the License at
00012 
00013       http://www.apache.org/licenses/LICENSE-2.0
00014 
00015   Unless required by applicable law or agreed to in writing, software
00016   distributed under the License is distributed on an "AS IS" BASIS,
00017   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018   See the License for the specific language governing permissions and
00019   limitations under the License.
00020  */
00021 
00022 #include "ink_config.h"
00023 #include "P_Net.h"
00024 
00025 typedef int (SSLNetAccept::*SSLNetAcceptHandler) (int, void *);
00026 
00027 // Virtual function allows the correct
00028 // etype to be used in NetAccept functions (ET_SSL
00029 // or ET_NET).
00030 EventType
00031 SSLNetAccept::getEtype() const
00032 {
00033   return SSLNetProcessor::ET_SSL;
00034 }
00035 
00036 NetProcessor *
00037 SSLNetAccept::getNetProcessor() const
00038 {
00039   return &sslNetProcessor;
00040 }
00041 
00042 void
00043 SSLNetAccept::init_accept_per_thread()
00044 {
00045   int i, n;
00046   NetAccept *a;
00047 
00048   if (do_listen(NON_BLOCKING))
00049     return;
00050   if (accept_fn == net_accept)
00051     SET_HANDLER((SSLNetAcceptHandler) & SSLNetAccept::acceptFastEvent);
00052   else
00053     SET_HANDLER((SSLNetAcceptHandler) & SSLNetAccept::acceptEvent);
00054   period = ACCEPT_PERIOD;
00055   n = eventProcessor.n_threads_for_type[SSLNetProcessor::ET_SSL];
00056   for (i = 0; i < n; i++) {
00057     if (i < n - 1)
00058       a = clone();
00059     else
00060       a = this;
00061     EThread *t = eventProcessor.eventthread[SSLNetProcessor::ET_SSL][i];
00062 
00063     PollDescriptor *pd = get_PollDescriptor(t);
00064     if (ep.start(pd, this, EVENTIO_READ) < 0)
00065       Debug("iocore_net", "error starting EventIO");
00066     a->mutex = get_NetHandler(t)->mutex;
00067     t->schedule_every(a, period, etype);
00068   }
00069 }
00070 
00071 NetAccept *
00072 SSLNetAccept::clone() const
00073 {
00074   NetAccept *na;
00075   na = new SSLNetAccept;
00076   *na = *this;
00077   return na;
00078 }

Generated by  doxygen 1.7.1