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

SpdySessionAccept.cc

Go to the documentation of this file.
00001 /** @file
00002 
00003   SpdyNetAccept
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #include "SpdySessionAccept.h"
00025 #include "Error.h"
00026 
00027 #if TS_HAS_SPDY
00028 #include "SpdyClientSession.h"
00029 #endif
00030 
00031 SpdySessionAccept::SpdySessionAccept(spdy::SessionVersion vers)
00032     : SessionAccept(new_ProxyMutex()), version(vers)
00033 {
00034 #if TS_HAS_SPDY
00035   ink_release_assert(spdy::SESSION_VERSION_2 <= vers && vers <= spdy::SESSION_VERSION_3_1);
00036 #endif
00037   SET_HANDLER(&SpdySessionAccept::mainEvent);
00038 }
00039 
00040 int
00041 SpdySessionAccept::mainEvent(int event, void * edata)
00042 {
00043   if (event == NET_EVENT_ACCEPT) {
00044     NetVConnection * netvc =static_cast<NetVConnection *>(edata);
00045 
00046 #if TS_HAS_SPDY
00047     spdy_cs_create(netvc, this->version, NULL, NULL);
00048 #else
00049     Error("accepted a SPDY session, but SPDY support is not available");
00050     netvc->do_io_close();
00051 #endif
00052 
00053     return EVENT_CONT;
00054   }
00055 
00056   MachineFatal("SPDY accept received fatal error: errno = %d", -((int)(intptr_t)edata));
00057   return EVENT_CONT;
00058 }
00059 
00060 void
00061 SpdySessionAccept::accept(NetVConnection * netvc, MIOBuffer * iobuf, IOBufferReader * reader)
00062 {
00063 #if TS_HAS_SPDY
00064   spdy_cs_create(netvc, this->version, iobuf, reader);
00065 #else
00066   (void)netvc;
00067   (void)iobuf;
00068   (void)reader;
00069   ink_release_assert(0);
00070 #endif
00071 }

Generated by  doxygen 1.7.1