Lines Matching full:cctx
3626 /* Try to start non-blocking connect to next host in cctx list */
3628 connect_next(struct channel_connect *cctx)
3634 for (; cctx->ai; cctx->ai = cctx->ai->ai_next) {
3635 switch (cctx->ai->ai_family) {
3638 sunaddr = (struct sockaddr_un *)cctx->ai->ai_addr;
3644 if (getnameinfo(cctx->ai->ai_addr, cctx->ai->ai_addrlen,
3654 if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype,
3655 cctx->ai->ai_protocol)) == -1) {
3656 if (cctx->ai->ai_next == NULL)
3664 if (connect(sock, cctx->ai->ai_addr,
3665 cctx->ai->ai_addrlen) == -1 && errno != EINPROGRESS) {
3667 "%.100s", cctx->host, ntop, strport,
3674 if (cctx->ai->ai_family != AF_UNIX)
3677 "in progress, fd=%d", cctx->host, ntop, strport, sock);
3678 cctx->ai = cctx->ai->ai_next;
3685 channel_connect_ctx_free(struct channel_connect *cctx)
3687 free(cctx->host);
3688 if (cctx->aitop) {
3689 if (cctx->aitop->ai_family == AF_UNIX)
3690 free(cctx->aitop);
3692 freeaddrinfo(cctx->aitop);
3694 memset(cctx, 0, sizeof(*cctx));
3705 struct channel_connect cctx;
3708 memset(&cctx, 0, sizeof(cctx));
3734 cctx.aitop = ai;
3740 if ((gaierr = getaddrinfo(name, strport, &hints, &cctx.aitop)) != 0) {
3747 cctx.host = xstrdup(name);
3748 cctx.port = port;
3749 cctx.ai = cctx.aitop;
3751 if ((sock = connect_next(&cctx)) == -1) {
3754 channel_connect_ctx_free(&cctx);
3759 c->connect_ctx = cctx;