MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / accept_loop

Method accept_loop

net/rsocket/rsocket.cpp:450–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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())

Callers

nothing calls this directly

Calls 5

acceptFunction · 0.85
thread_yieldFunction · 0.85
thread_create11Function · 0.50
ERRNOClass · 0.50
timeoutMethod · 0.45

Tested by

no test coverage detected