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

Function client_open

lib_acl/src/master/template/acl_threads_server.c:691–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691static void client_open(ACL_EVENT *event, acl_pthread_pool_t *threads,
692 ACL_SOCKET fd, const char *remote, const char *local)
693{
694 ACL_VSTREAM *stream;
695 READ_CTX *ctx;
696
697#ifdef ACL_UNIX
698 acl_close_on_exec(fd, ACL_CLOSE_ON_EXEC);
699#endif
700
701 increase_client_counter();
702
703 __use_count++;
704
705 stream = acl_vstream_fdopen(fd, O_RDWR, acl_var_threads_buf_size,
706 acl_var_threads_rw_timeout, ACL_VSTREAM_TYPE_SOCK);
707 if (remote) {
708 acl_vstream_set_peer(stream, remote);
709 }
710 if (local) {
711 acl_vstream_set_local(stream, local);
712 }
713
714 /**
715 * when the stream is closed, the callback will be called
716 * to decrease the counter
717 */
718 acl_vstream_add_close_handle(stream, decrease_counter_callback, NULL);
719
720 /* create one job running in one thread*/
721 ctx = create_job(event, threads, stream);
722 if (ctx->serv_accept != NULL
723 && ctx->serv_accept(ctx->serv_arg, stream) < 0) {
724
725 if (ctx->serv_close != NULL) {
726 ctx->serv_close(ctx->serv_arg, stream);
727 }
728 acl_vstream_close(stream);
729 } else {
730 ctx->event_type = ACL_EVENT_ACCEPT;
731 acl_pthread_pool_add_job(ctx->threads, ctx->job);
732 }
733}
734
735void acl_threads_server_enable_read(ACL_EVENT *event,
736 acl_pthread_pool_t *threads, ACL_VSTREAM *stream)

Callers 2

dispatch_receiveFunction · 0.85

Calls 8

acl_close_on_execFunction · 0.85
acl_vstream_set_peerFunction · 0.85
acl_vstream_set_localFunction · 0.85
create_jobFunction · 0.85
acl_vstream_closeFunction · 0.85
acl_pthread_pool_add_jobFunction · 0.85
increase_client_counterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…