#define set_ipv6_v6only(x,y)
#endif
-static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd)
+static void tcpnodelay(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ curl_socket_t sockfd)
{
#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
curl_socklen_t onoff = (curl_socklen_t) 1;
if(setsockopt(sockfd, level, TCP_NODELAY,
(void *)&onoff, sizeof(onoff)) < 0)
- infof(data, "Could not set TCP_NODELAY: %s",
- curlx_strerror(SOCKERRNO, buffer, sizeof(buffer)));
+ CURL_TRC_CF(data, cf, "Could not set TCP_NODELAY: %s",
+ curlx_strerror(SOCKERRNO, buffer, sizeof(buffer)));
#else
+ (void)cf;
(void)data;
(void)sockfd;
#endif
sending data to a dead peer (instead of relying on the 4th argument to send
being MSG_NOSIGNAL). Possibly also existing and in use on other BSD
systems? */
-static void nosigpipe(struct Curl_easy *data,
+static void nosigpipe(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
curl_socket_t sockfd)
{
int onoff = 1;
- (void)data;
if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE,
(void *)&onoff, sizeof(onoff)) < 0) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
char buffer[STRERROR_LEN];
- infof(data, "Could not set SO_NOSIGPIPE: %s",
- curlx_strerror(SOCKERRNO, buffer, sizeof(buffer)));
+ CURL_TRC_CF(data, cf, "Could not set SO_NOSIGPIPE: %s",
+ curlx_strerror(SOCKERRNO, buffer, sizeof(buffer)));
+#else
+ (void)cf;
+ (void)data;
#endif
}
}
#else
-#define nosigpipe(x,y) Curl_nop_stmt
+#define nosigpipe(x,y,z) Curl_nop_stmt
#endif
#if defined(USE_WINSOCK) && \
#endif
static void
-tcpkeepalive(struct Curl_easy *data,
+tcpkeepalive(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
curl_socket_t sockfd)
{
int optval = data->set.tcp_keepalive ? 1 : 0;
/* only set IDLE and INTVL if setting KEEPALIVE is successful */
if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set SO_KEEPALIVE on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set SO_KEEPALIVE on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
else {
#ifdef SIO_KEEPALIVE_VALS /* Windows */
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(const char *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPIDLE on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPIDLE on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
optval = curlx_sltosi(data->set.tcp_keepintvl);
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(const char *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPINTVL on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPINTVL on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
optval = curlx_sltosi(data->set.tcp_keepcnt);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT,
(const char *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPCNT on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPCNT on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
#else /* Windows < 10.0.16299 */
struct tcp_keepalive vals;
vals.keepaliveinterval = (u_long)optval;
if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals),
NULL, 0, &dummy, NULL, NULL) != 0) {
- infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd "
- "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set SIO_KEEPALIVE_VALS on fd "
+ "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#endif
#else /* !Windows */
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPIDLE on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPIDLE on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
#elif defined(TCP_KEEPALIVE)
/* macOS style */
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPALIVE on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
#elif defined(TCP_KEEPALIVE_THRESHOLD)
/* Solaris <11.4 style */
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_THRESHOLD,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPALIVE_THRESHOLD on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE_THRESHOLD on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
#endif
#ifdef TCP_KEEPINTVL
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPINTVL on fd "
- "%" FMT_SOCKET_T ": errno %d",
- sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPINTVL on fd "
+ "%" FMT_SOCKET_T ": errno %d",
+ sockfd, SOCKERRNO);
}
#elif defined(TCP_KEEPALIVE_ABORT_THRESHOLD)
/* Solaris <11.4 style */
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPALIVE_ABORT_THRESHOLD on fd "
- "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE_ABORT_THRESHOLD"
+ " on fd %" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#endif
#ifdef TCP_KEEPCNT
optval = curlx_sltosi(data->set.tcp_keepcnt);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT,
(void *)&optval, sizeof(optval)) < 0) {
- infof(data, "Failed to set TCP_KEEPCNT on fd "
- "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
+ CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPCNT on fd "
+ "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#endif
#endif
ctx->addr.socktype == SOCK_STREAM;
#endif
if(is_tcp && data->set.tcp_nodelay)
- tcpnodelay(data, ctx->sock);
+ tcpnodelay(cf, data, ctx->sock);
- nosigpipe(data, ctx->sock);
+ nosigpipe(cf, data, ctx->sock);
Curl_sndbuf_init(ctx->sock);
if(is_tcp && data->set.tcp_keepalive)
- tcpkeepalive(data, ctx->sock);
+ tcpkeepalive(cf, data, ctx->sock);
if(data->set.fsockopt) {
/* activate callback for setting socket options */
#elif defined(TCP_FASTOPEN_CONNECT) /* Linux >= 4.11 */
if(setsockopt(ctx->sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT,
(void *)&optval, sizeof(optval)) < 0)
- infof(data, "Failed to enable TCP Fast Open on fd %" FMT_SOCKET_T,
- ctx->sock);
+ CURL_TRC_CF(data, cf, "Failed to enable TCP Fast Open on fd %"
+ FMT_SOCKET_T, ctx->sock);
rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen);
#elif defined(MSG_FASTOPEN) /* old Linux */