MCPcopy Create free account
hub / github.com/apache/trafficserver / mainEvent

Method mainEvent

src/proxy/ProtocolProbeSessionAccept.cc:179–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177};
178
179int
180ProtocolProbeSessionAccept::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
217bool
218ProtocolProbeSessionAccept::accept(NetVConnection *, MIOBuffer *, IOBufferReader *)

Callers

nothing calls this directly

Calls 10

acquireFunction · 0.85
releaseFunction · 0.85
get_writerMethod · 0.80
get_readerMethod · 0.80
ink_abortFunction · 0.50
do_io_readMethod · 0.45
reenableMethod · 0.45
ioCompletionEventMethod · 0.45

Tested by

no test coverage detected