Lines Matching defs:cctx
3076 /* Try to start non-blocking connect to next host in cctx list */
3078 connect_next(struct channel_connect *cctx)
3083 for (; cctx->ai; cctx->ai = cctx->ai->ai_next) {
3084 if (cctx->ai->ai_family != AF_INET &&
3085 cctx->ai->ai_family != AF_INET6)
3087 if (getnameinfo(cctx->ai->ai_addr, cctx->ai->ai_addrlen,
3093 if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype,
3094 cctx->ai->ai_protocol)) == -1) {
3095 if (cctx->ai->ai_next == NULL)
3103 if (connect(sock, cctx->ai->ai_addr,
3104 cctx->ai->ai_addrlen) == -1 && errno != EINPROGRESS) {
3106 "%.100s", cctx->host, ntop, strport,
3114 "in progress, fd=%d", cctx->host, ntop, strport, sock);
3115 cctx->ai = cctx->ai->ai_next;
3123 channel_connect_ctx_free(struct channel_connect *cctx)
3125 xfree(cctx->host);
3126 if (cctx->aitop)
3127 freeaddrinfo(cctx->aitop);
3128 bzero(cctx, sizeof(*cctx));
3129 cctx->host = NULL;
3130 cctx->ai = cctx->aitop = NULL;
3141 struct channel_connect cctx;
3144 memset(&cctx, 0, sizeof(cctx));
3149 if ((gaierr = getaddrinfo(host, strport, &hints, &cctx.aitop)) != 0) {
3155 cctx.host = xstrdup(host);
3156 cctx.port = port;
3157 cctx.ai = cctx.aitop;
3159 if ((sock = connect_next(&cctx)) == -1) {
3162 channel_connect_ctx_free(&cctx);
3167 c->connect_ctx = cctx;