| 327 | } |
| 328 | |
| 329 | void |
| 330 | start_HttpProxyServer() |
| 331 | { |
| 332 | static bool called_once = false; |
| 333 | HttpProxyPort::Group &proxy_ports = HttpProxyPort::global(); |
| 334 | |
| 335 | /////////////////////////////////// |
| 336 | // start accepting connections // |
| 337 | /////////////////////////////////// |
| 338 | |
| 339 | ink_assert(!called_once); |
| 340 | ink_assert(proxy_ports.size() == HttpProxyAcceptors.size()); |
| 341 | |
| 342 | for (int i = 0, n = proxy_ports.size(); i < n; ++i) { |
| 343 | HttpProxyAcceptor &acceptor = HttpProxyAcceptors[i]; |
| 344 | HttpProxyPort &port = proxy_ports[i]; |
| 345 | if (port.isSSL()) { |
| 346 | if (nullptr == sslNetProcessor.main_accept(acceptor._accept, port.m_fd, acceptor._net_opt)) { |
| 347 | return; |
| 348 | } |
| 349 | #if TS_USE_QUIC == 1 |
| 350 | } else if (port.isQUIC()) { |
| 351 | if (nullptr == quic_NetProcessor.main_accept(acceptor._accept, port.m_fd, acceptor._net_opt)) { |
| 352 | return; |
| 353 | } |
| 354 | #endif |
| 355 | } else if (!port.isPlugin()) { |
| 356 | if (nullptr == netProcessor.main_accept(acceptor._accept, port.m_fd, acceptor._net_opt)) { |
| 357 | return; |
| 358 | } |
| 359 | } |
| 360 | // XXX although we make a good pretence here, I don't believe that NetProcessor::main_accept() ever actually returns |
| 361 | // NULL. It would be useful to be able to detect errors and spew them here though. |
| 362 | } |
| 363 | |
| 364 | // Alert plugins that connections will be accepted. |
| 365 | APIHook *hook = g_lifecycle_hooks->get(TS_LIFECYCLE_PORTS_READY_HOOK); |
| 366 | while (hook) { |
| 367 | hook->invoke(TS_EVENT_LIFECYCLE_PORTS_READY, nullptr); |
| 368 | hook = hook->next(); |
| 369 | } |
| 370 | |
| 371 | prewarmManager.start(); |
| 372 | } |
| 373 | |
| 374 | void |
| 375 | stop_HttpProxyServer() |