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 "Http2SessionAccept.h"
00025 #include "Http2ClientSession.h"
00026 #include "I_Machine.h"
00027 #include "Error.h"
00028 
00029 Http2SessionAccept::Http2SessionAccept(const HttpSessionAccept::Options& _o)
00030   : SessionAccept(NULL), options(_o)
00031 {
00032   SET_HANDLER(&Http2SessionAccept::mainEvent);
00033 }
00034 
00035 Http2SessionAccept::~Http2SessionAccept()
00036 {
00037 }
00038 
00039 void
00040 Http2SessionAccept::accept(NetVConnection * netvc, MIOBuffer * iobuf, IOBufferReader * reader)
00041 {
00042   
00043   
00044   Warning("skipping access control checks for HTTP/2 connection");
00045 
00046   netvc->attributes = this->options.transport_type;
00047 
00048   if (is_debug_tag_set("http2_seq")) {
00049     const sockaddr * client_ip = netvc->get_remote_addr();
00050     ip_port_text_buffer ipb;
00051 
00052     Debug("http2_seq", "[HttpSessionAccept2:mainEvent %p] accepted connection from %s transport type = %d",
00053       netvc, ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
00054   }
00055 
00056   
00057   Http2ClientSession * new_session = http2ClientSessionAllocator.alloc();
00058 
00059   new_session->new_connection(netvc, iobuf, reader, false );
00060 }
00061 
00062 int
00063 Http2SessionAccept::mainEvent(int event, void *data)
00064 {
00065   ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
00066   ink_release_assert((event == NET_EVENT_ACCEPT) ? (data != 0) : (1));
00067 
00068   if (event == NET_EVENT_ACCEPT) {
00069     this->accept(static_cast<NetVConnection *>(data), NULL, NULL);
00070     return EVENT_CONT;
00071   }
00072 
00073   
00074   
00075   if (((long) data) == -ECONNABORTED) {
00076     HTTP_SUM_DYN_STAT(http_ua_msecs_counts_errors_pre_accept_hangups_stat, 0);
00077   }
00078 
00079   MachineFatal("HTTP/2 accept received fatal error: errno = %d", -((int)(intptr_t)data));
00080   return EVENT_CONT;
00081 }