[BUILD] fix build for systems without SOL_TCP

Andrew Azarov reported that haproxy-1.4-dev1 does not build
under FreeBSD 7.2 because SOL_TCP is not defined. So add a
check for its definition before using it. This only impacts
network optimisations anyway.
This commit is contained in:
Willy Tarreau 2009-08-16 14:13:47 +02:00
parent b55932ddaf
commit c9fce2fee8
4 changed files with 6 additions and 6 deletions

View File

@ -1968,7 +1968,7 @@ int connect_server(struct session *s)
}
}
#ifdef TCP_QUICKACK
#if defined(TCP_QUICKACK) && defined(SOL_TCP)
/* disabling tcp quick ack now allows the first request to leave the
* machine with the first ACK. We only do this if there are pending
* data in the buffer.

View File

@ -678,7 +678,7 @@ struct task *process_chk(struct task *t)
}
if (s->result == SRV_CHK_UNKNOWN) {
#ifdef TCP_QUICKACK
#if defined(TCP_QUICKACK) && defined(SOL_TCP)
/* disabling tcp quick ack now allows
* the request to leave the machine with
* the first ACK.

View File

@ -251,7 +251,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
}
}
#endif
#ifdef TCP_MAXSEG
#if defined(TCP_MAXSEG) && defined(SOL_TCP)
if (listener->maxseg) {
if (setsockopt(fd, SOL_TCP, TCP_MAXSEG,
&listener->maxseg, sizeof(listener->maxseg)) == -1) {
@ -272,7 +272,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
goto tcp_close_return;
}
#ifdef TCP_QUICKACK
#if defined(TCP_QUICKACK) && defined(SOL_TCP)
if (listener->options & LI_O_NOQUICKACK)
setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
#endif

View File

@ -587,7 +587,7 @@ static int stream_sock_write_loop(struct stream_interface *si, struct buffer *b)
max = b->send_max;
#ifdef TCP_CORK
#if defined(TCP_CORK) && defined(SOL_TCP)
/*
* Check if we want to cork output before sending. This typically occurs
* when there are data left in the buffer, or when we reached the end of
@ -670,7 +670,7 @@ static int stream_sock_write_loop(struct stream_interface *si, struct buffer *b)
*/
if (unlikely((fdtab[si->fd].flags & (FD_FL_TCP|FD_FL_TCP_NODELAY)) == FD_FL_TCP && (b->flags & BF_EMPTY))) {
if ((b->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) != (BF_WRITE_ENA|BF_SHUTR)) {
#ifdef TCP_CORK
#if defined(TCP_CORK) && defined(SOL_TCP)
if (fdtab[si->fd].flags & FD_FL_TCP_CORK)
setsockopt(si->fd, SOL_TCP, TCP_CORK, (char *) &zero, sizeof(zero));
#endif