| 177 | }; |
| 178 | |
| 179 | int |
| 180 | ProtocolProbeSessionAccept::mainEvent(int event, void *data) |
| 181 | { |
| 182 | if (event == NET_EVENT_ACCEPT) { |
| 183 | ink_assert(data); |
| 184 | |
| 185 | VIO *vio; |
| 186 | NetVConnection *netvc = static_cast<NetVConnection *>(data); |
| 187 | ProtocolProbeTrampoline *probe; |
| 188 | UnixNetVConnection *unix_netvc = dynamic_cast<UnixNetVConnection *>(netvc); |
| 189 | if (unix_netvc != nullptr && unix_netvc->read.vio.get_writer() != nullptr) { |
| 190 | probe = new ProtocolProbeTrampoline(this, netvc->mutex, unix_netvc->read.vio.get_writer(), unix_netvc->read.vio.get_reader()); |
| 191 | } else { |
| 192 | probe = new ProtocolProbeTrampoline(this, netvc->mutex, nullptr, nullptr); |
| 193 | } |
| 194 | |
| 195 | // The connection has completed, set the accept inactivity timeout here to watch over the difference between the |
| 196 | // connection set up and the first transaction.. |
| 197 | HttpConfigParams *param = HttpConfig::acquire(); |
| 198 | netvc->set_inactivity_timeout(HRTIME_SECONDS(param->accept_no_activity_timeout)); |
| 199 | HttpConfig::release(param); |
| 200 | |
| 201 | if (!probe->reader->is_read_avail_more_than(0)) { |
| 202 | Dbg(dbg_ctl_http, "probe needs data, read.."); |
| 203 | vio = netvc->do_io_read(probe, BUFFER_SIZE_FOR_INDEX(ProtocolProbeTrampoline::buffer_size_index), probe->iobuf); |
| 204 | vio->reenable(); |
| 205 | } else { |
| 206 | Dbg(dbg_ctl_http, "probe already has data, call ioComplete directly.."); |
| 207 | vio = netvc->do_io_read(this, 0, nullptr); |
| 208 | probe->ioCompletionEvent(VC_EVENT_READ_COMPLETE, (void *)vio); |
| 209 | } |
| 210 | return EVENT_CONT; |
| 211 | } |
| 212 | |
| 213 | ink_abort("Protocol probe received a fatal error: errno = %d", -(static_cast<int>((intptr_t)data))); |
| 214 | return EVENT_CONT; |
| 215 | } |
| 216 | |
| 217 | bool |
| 218 | ProtocolProbeSessionAccept::accept(NetVConnection *, MIOBuffer *, IOBufferReader *) |
nothing calls this directly
no test coverage detected