| 448 | } |
| 449 | bool check_running() { return workth.load(); } |
| 450 | int accept_loop() { |
| 451 | photon::thread* th = nullptr; |
| 452 | if (!workth.compare_exchange_strong(th, photon::CURRENT)) |
| 453 | LOG_ERROR_RETURN(EALREADY, -1, "Already listening"); |
| 454 | while (check_running()) { |
| 455 | waiting = true; |
| 456 | auto connection = accept(); |
| 457 | waiting = false; |
| 458 | if (!check_running()) return 0; |
| 459 | if (connection) { |
| 460 | connection->timeout(m_timeout); |
| 461 | photon::thread_create11(&RSocketServer::handler, m_handler, |
| 462 | connection); |
| 463 | } else { |
| 464 | LOG_WARN( |
| 465 | "KernelSocketServer: failed to accept new connections: `", |
| 466 | ERRNO()); |
| 467 | photon::thread_yield(); |
| 468 | } |
| 469 | } |
| 470 | return 0; |
| 471 | } |
| 472 | |
| 473 | int start_loop(bool block) override { |
| 474 | if (check_running()) |
nothing calls this directly
no test coverage detected