Initialize the NetAccept for execution in its own thread. This should be done for low latency, high connection rate sockets.
| 200 | // This should be done for low latency, high connection rate sockets. |
| 201 | // |
| 202 | void |
| 203 | NetAccept::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. |
no test coverage detected