| 461 | } |
| 462 | |
| 463 | static 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 | |
| 498 | static int main_dispatch_report(ACL_VSTREAM *conn) |
| 499 | { |
no test coverage detected
searching dependent graphs…