Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 }