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

Function main_dispatch_receive

lib_fiber/cpp/src/fiber_server.cpp:463–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463static int main_dispatch_receive(int dispatch_fd)
464{
465 char buf[256], remote[256], local[256];
466 int fd = -1, ret;
467 ACL_VSTREAM *cstream;
468 ACL_FIBER_ATTR attr;
469
470 acl_fiber_attr_init(&attr);
471 acl_fiber_attr_setstacksize(&attr, acl_var_fiber_stack_size);
472 acl_fiber_attr_setsharestack(&attr, acl_var_fiber_share_stack ? 1 : 0);
473
474 ret = acl_read_fd(dispatch_fd, buf, sizeof(buf) - 1, &fd);
475 if (ret < 0 || fd < 0) {
476 acl_msg_warn("%s(%d), %s: read from master_dispatch(%s) error",
477 __FILE__, __LINE__, __FUNCTION__,
478 acl_var_fiber_dispatch_addr);
479 return -1;
480 }
481
482 buf[ret] = 0;
483
484 cstream = acl_vstream_fdopen(fd, O_RDWR, acl_var_fiber_buf_size,
485 acl_var_fiber_rw_timeout, ACL_VSTREAM_TYPE_SOCK);
486
487 if (acl_getsockname(fd, local, sizeof(local)) == 0) {
488 acl_vstream_set_local(cstream, local);
489 }
490 if (acl_getpeername(fd, remote, sizeof(remote)) == 0) {
491 acl_vstream_set_peer(cstream, remote);
492 }
493
494 acl_fiber_create2(&attr, fiber_client, cstream);
495 return 0;
496}
497
498static int main_dispatch_report(ACL_VSTREAM *conn)
499{

Callers 1

main_dispatch_pollFunction · 0.70

Calls 10

acl_fiber_attr_initFunction · 0.85
acl_read_fdFunction · 0.85
acl_msg_warnFunction · 0.85
acl_getsocknameFunction · 0.85
acl_vstream_set_localFunction · 0.85
acl_getpeernameFunction · 0.85
acl_vstream_set_peerFunction · 0.85
acl_fiber_create2Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…