Skip to content

Commit

Permalink
* libwget/net.c: Silence -Wundef if TCP_FASTOPEN is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot committed Apr 6, 2017
1 parent bc824ea commit 2c17f6f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libwget/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,7 @@ static int G_GNUC_WGET_CONST _family_to_value(int family)

void wget_tcp_set_tcp_fastopen(wget_tcp_t *tcp, int tcp_fastopen)
{
#if defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN)
(tcp ? tcp : &_global_tcp)->tcp_fastopen = tcp_fastopen;
#endif
}

int wget_tcp_get_tcp_fastopen(wget_tcp_t *tcp)
Expand Down Expand Up @@ -593,6 +591,7 @@ int wget_tcp_connect(wget_tcp_t *tcp, const char *host, const char *port)
}
}

#ifdef TCP_FASTOPEN
if (tcp->tcp_fastopen) {
rc = 0;
errno = 0;
Expand All @@ -602,6 +601,10 @@ int wget_tcp_connect(wget_tcp_t *tcp, const char *host, const char *port)
rc = connect(sockfd, ai->ai_addr, ai->ai_addrlen);
tcp->first_send = 0;
}
#else
rc = connect(sockfd, ai->ai_addr, ai->ai_addrlen);
tcp->first_send = 0;
#endif

if (rc < 0
&& errno != EAGAIN
Expand Down Expand Up @@ -724,7 +727,7 @@ wget_tcp_t *wget_tcp_accept(wget_tcp_t *parent_tcp)
return NULL;
}

if ((sockfd = accept(parent_tcp->sockfd, parent_tcp->bind_addrinfo->ai_addr, &parent_tcp->bind_addrinfo->ai_addrlen)) != -1) {
if ((sockfd = accept(parent_tcp->sockfd, parent_tcp->bind_addrinfo->ai_addr, (socklen_t *) &parent_tcp->bind_addrinfo->ai_addrlen)) != -1) {
wget_tcp_t *tcp = xmalloc(sizeof(wget_tcp_t));

*tcp = *parent_tcp;
Expand Down

0 comments on commit 2c17f6f

Please sign in to comment.