| 516 | } |
| 517 | |
| 518 | static 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 | |
| 553 | static void main_fiber_dispatch(ACL_FIBER *fiber, void *ctx acl_unused) |
| 554 | { |
no test coverage detected
searching dependent graphs…