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

Method init_accept_loop

src/iocore/net/UnixNetAccept.cc:202–227  ·  view source on GitHub ↗

Initialize the NetAccept for execution in its own thread. This should be done for low latency, high connection rate sockets.

Source from the content-addressed store, hash-verified

200// This should be done for low latency, high connection rate sockets.
201//
202void
203NetAccept::init_accept_loop()
204{
205 int i, n;
206 char thr_name[MAX_THREAD_NAME_LENGTH];
207 size_t stacksize;
208 if (do_blocking_listen()) {
209 return;
210 }
211 REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
212 SET_CONTINUATION_HANDLER(this, &NetAccept::acceptLoopEvent);
213
214 n = opt.accept_threads;
215 // Fill in accept thread from configuration if necessary.
216 if (n < 0) {
217 REC_ReadConfigInteger(n, "proxy.config.accept_threads");
218 }
219
220 for (i = 0; i < n; i++) {
221 NetAccept *a = (i < n - 1) ? clone() : this;
222 snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i, ats_ip_port_host_order(&server.accept_addr));
223 eventProcessor.spawn_thread(a, thr_name, stacksize);
224 Dbg(dbg_ctl_iocore_net_accept_start, "Created accept thread #%d for port %d", i + 1,
225 ats_ip_port_host_order(&server.accept_addr));
226 }
227}
228
229//
230// Initialize the NetAccept for execution in a etype thread.

Callers 1

accept_internalMethod · 0.80

Calls 2

ats_ip_port_host_orderFunction · 0.85
spawn_threadMethod · 0.80

Tested by

no test coverage detected