Lines Matching refs:sock
408 int use_callback, curl_socket_t sock) in socket_close() argument
410 if(CURL_SOCKET_BAD == sock) in socket_close()
415 Curl_multi_closed(data, sock); in socket_close()
417 rc = conn->fclosesocket(conn->closesocket_client, sock); in socket_close()
424 Curl_multi_closed(data, sock); in socket_close()
426 sclose(sock); in socket_close()
437 curl_socket_t sock) in Curl_socket_close() argument
439 return socket_close(data, conn, FALSE, sock); in Curl_socket_close()
572 struct sockaddr *sock = (struct sockaddr *)&sa; /* bind to this address */ in bindlocal() local
789 if(bind(sockfd, sock, sizeof_sa) >= 0) { in bindlocal()
802 if(sock->sa_family == AF_INET) in bindlocal()
939 curl_socket_t sock; /* current attempt socket */ member
967 ctx->sock = CURL_SOCKET_BAD; in cf_socket_ctx_init()
1004 if(ctx && CURL_SOCKET_BAD != ctx->sock) { in cf_socket_close()
1005 CURL_TRC_CF(data, cf, "cf_socket_close(%" FMT_SOCKET_T ")", ctx->sock); in cf_socket_close()
1006 if(ctx->sock == cf->conn->sock[cf->sockindex]) in cf_socket_close()
1007 cf->conn->sock[cf->sockindex] = CURL_SOCKET_BAD; in cf_socket_close()
1008 socket_close(data, cf->conn, !ctx->accepted, ctx->sock); in cf_socket_close()
1009 ctx->sock = CURL_SOCKET_BAD; in cf_socket_close()
1027 CURL_TRC_CF(data, cf, "cf_socket_shutdown(%" FMT_SOCKET_T ")", ctx->sock); in cf_socket_shutdown()
1031 if(ctx->sock != CURL_SOCKET_BAD && in cf_socket_shutdown()
1033 (curlx_nonblock(ctx->sock, TRUE) >= 0)) { in cf_socket_shutdown()
1035 (void)sread(ctx->sock, buf, sizeof(buf)); in cf_socket_shutdown()
1058 if((ctx->sock != CURL_SOCKET_BAD) && in set_local_ip()
1067 if(getsockname(ctx->sock, (struct sockaddr*) &ssloc, &slen)) { in set_local_ip()
1118 DEBUGASSERT(ctx->sock == CURL_SOCKET_BAD); in cf_socket_open()
1128 result = socket_open(data, &ctx->addr, &ctx->sock); in cf_socket_open()
1143 set_ipv6_v6only(ctx->sock, 0); in cf_socket_open()
1159 tcpnodelay(data, ctx->sock); in cf_socket_open()
1161 nosigpipe(data, ctx->sock); in cf_socket_open()
1163 Curl_sndbuf_init(ctx->sock); in cf_socket_open()
1166 tcpkeepalive(data, ctx->sock); in cf_socket_open()
1172 ctx->sock, in cf_socket_open()
1191 result = bindlocal(data, cf->conn, ctx->sock, ctx->addr.family, in cf_socket_open()
1207 error = curlx_nonblock(ctx->sock, TRUE); in cf_socket_open()
1217 error = curlx_nonblock(ctx->sock, TRUE); in cf_socket_open()
1228 if(ctx->sock != CURL_SOCKET_BAD) { in cf_socket_open()
1229 socket_close(data, cf->conn, TRUE, ctx->sock); in cf_socket_open()
1230 ctx->sock = CURL_SOCKET_BAD; in cf_socket_open()
1239 result, ctx->sock); in cf_socket_open()
1267 rc = connectx(ctx->sock, &endpoints, SAE_ASSOCID_ANY, in do_connect()
1272 rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen); in do_connect()
1275 rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen); in do_connect()
1278 if(setsockopt(ctx->sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, in do_connect()
1281 ctx->sock); in do_connect()
1283 rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen); in do_connect()
1286 rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen); in do_connect()
1292 rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, in do_connect()
1317 if(ctx->sock == CURL_SOCKET_BAD) { in cf_tcp_connect()
1346 (void)verifyconnect(ctx->sock, NULL); in cf_tcp_connect()
1349 rc = SOCKET_WRITABLE(ctx->sock, 0); in cf_tcp_connect()
1356 if(verifyconnect(ctx->sock, &ctx->error)) { in cf_tcp_connect()
1367 (void)verifyconnect(ctx->sock, &ctx->error); in cf_tcp_connect()
1387 if(ctx->sock != CURL_SOCKET_BAD) { in cf_tcp_connect()
1388 socket_close(data, cf->conn, TRUE, ctx->sock); in cf_tcp_connect()
1389 ctx->sock = CURL_SOCKET_BAD; in cf_tcp_connect()
1415 if(ctx->sock != CURL_SOCKET_BAD) { in cf_socket_adjust_pollset()
1421 Curl_pollset_set_in_only(data, ps, ctx->sock); in cf_socket_adjust_pollset()
1423 FMT_SOCKET_T, ctx->sock); in cf_socket_adjust_pollset()
1426 Curl_pollset_set_out_only(data, ps, ctx->sock); in cf_socket_adjust_pollset()
1428 FMT_SOCKET_T, ctx->sock); in cf_socket_adjust_pollset()
1431 Curl_pollset_add_in(data, ps, ctx->sock); in cf_socket_adjust_pollset()
1433 FMT_SOCKET_T, ctx->sock); in cf_socket_adjust_pollset()
1445 readable = SOCKET_READABLE(ctx->sock, 0); in cf_socket_data_pending()
1462 if(!WSAIoctl(ctx->sock, SIO_IDEAL_SEND_BACKLOG_QUERY, 0, 0, in win_update_sndbuf_size()
1465 !setsockopt(ctx->sock, SOL_SOCKET, SO_SNDBUF, in win_update_sndbuf_size()
1486 fdsave = cf->conn->sock[cf->sockindex]; in cf_socket_send()
1487 cf->conn->sock[cf->sockindex] = ctx->sock; in cf_socket_send()
1498 cf->conn->sock[cf->sockindex] = fdsave; in cf_socket_send()
1513 nwritten = sendto(ctx->sock, buf, len, MSG_FASTOPEN, in cf_socket_send()
1520 nwritten = swrite(ctx->sock, buf, len); in cf_socket_send()
1556 cf->conn->sock[cf->sockindex] = fdsave; in cf_socket_send()
1588 nread = sread(ctx->sock, buf, len); in cf_socket_recv()
1643 cf->conn->sock[cf->sockindex] = ctx->sock; in cf_socket_active()
1675 ctx->sock = CURL_SOCKET_BAD; in cf_socket_cntrl()
1691 if(!ctx || ctx->sock == CURL_SOCKET_BAD) in cf_socket_conn_is_alive()
1695 pfd[0].fd = ctx->sock; in cf_socket_conn_is_alive()
1727 *((curl_socket_t *)pres2) = ctx->sock; in cf_socket_query()
1832 DEBUGASSERT(ctx->sock != CURL_SOCKET_BAD); in cf_udp_setup_quic()
1834 rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, in cf_udp_setup_quic()
1844 ctx->sock, ctx->ip.local_ip, ctx->ip.local_port, in cf_udp_setup_quic()
1856 (void)setsockopt(ctx->sock, IPPROTO_IP, IP_MTU_DISCOVER, &val, in cf_udp_setup_quic()
1864 (void)setsockopt(ctx->sock, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val, in cf_udp_setup_quic()
1874 (void)setsockopt(ctx->sock, IPPROTO_UDP, UDP_GRO, &one, in cf_udp_setup_quic()
1894 if(ctx->sock == CURL_SOCKET_BAD) { in cf_udp_connect()
1907 ctx->sock, ctx->ip.local_ip, ctx->ip.local_port); in cf_udp_connect()
1911 FMT_SOCKET_T " (unconnected)", ctx->sock); in cf_udp_connect()
2066 if(getpeername(ctx->sock, (struct sockaddr*) &ssrem, &plen)) { in cf_tcp_set_accepted_remote_ip()
2117 " ip=%s:%d", ctx->sock, ctx->ip.local_ip, ctx->ip.local_port); in cf_tcp_accept_connect()
2118 socketstate = Curl_socket_check(ctx->sock, CURL_SOCKET_BAD, in cf_tcp_accept_connect()
2140 if(0 == getsockname(ctx->sock, (struct sockaddr *) &add, &size)) { in cf_tcp_accept_connect()
2142 s_accepted = accept(ctx->sock, (struct sockaddr *) &add, &size); in cf_tcp_accept_connect()
2155 socket_close(data, cf->conn, TRUE, ctx->sock); in cf_tcp_accept_connect()
2156 ctx->sock = s_accepted; in cf_tcp_accept_connect()
2158 cf->conn->sock[cf->sockindex] = ctx->sock; in cf_tcp_accept_connect()
2166 ctx->sock, ctx->ip.remote_ip, ctx->ip.remote_port); in cf_tcp_accept_connect()
2174 ctx->sock, CURLSOCKTYPE_ACCEPT); in cf_tcp_accept_connect()
2212 DEBUGASSERT(conn->sock[sockindex] == CURL_SOCKET_BAD); in Curl_conn_tcp_listen_set()
2220 ctx->sock = *s; in Curl_conn_tcp_listen_set()
2229 conn->sock[sockindex] = ctx->sock; in Curl_conn_tcp_listen_set()
2232 " ip=%s:%d", ctx->sock, in Curl_conn_tcp_listen_set()
2277 *psock = ctx->sock; in Curl_cf_socket_peek()