MCPcopy Create free account
hub / github.com/acl-dev/acl / main_dispatch_poll

Function main_dispatch_poll

lib_fiber/cpp/src/fiber_server.cpp:518–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518static void main_dispatch_poll(ACL_VSTREAM *conn)
519{
520 struct pollfd pfd;
521 time_t last = time(NULL);
522
523 memset(&pfd, 0, sizeof(pfd));
524 pfd.fd = ACL_VSTREAM_SOCK(conn);
525 pfd.events = POLLIN;
526
527 while (!__server_stopping) {
528 int n = poll(&pfd, 1, 1000);
529 if (n < 0) {
530 acl_msg_error("%s(%d), %s: poll error %s", __FILE__,
531 __LINE__, __FUNCTION__, acl_last_serror());
532 break;
533 }
534
535 if (n > 0 && pfd.revents & POLLIN) {
536 if (main_dispatch_receive(ACL_VSTREAM_SOCK(conn)) < 0) {
537 break;
538 }
539
540 pfd.revents = 0;
541 }
542
543 if (time(NULL) - last >= 1) {
544 if (main_dispatch_report(conn) < 0) {
545 break;
546 }
547
548 last = time(NULL);
549 }
550 }
551}
552
553static void main_fiber_dispatch(ACL_FIBER *fiber, void *ctx acl_unused)
554{

Callers 1

main_fiber_dispatchFunction · 0.70

Calls 5

acl_msg_errorFunction · 0.85
acl_last_serrorFunction · 0.85
main_dispatch_receiveFunction · 0.70
main_dispatch_reportFunction · 0.70
pollFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…