]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] apply tcp-smart-connect option for the checks too
authorWilly Tarreau <w@1wt.eu>
Wed, 15 Jul 2009 05:16:31 +0000 (07:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Jul 2009 05:16:31 +0000 (07:16 +0200)
We should respect tcp-smart-connect for checks too. First it reduces
the traffic, and second it ensures that the checks see the same thing
as the production traffic, which is better for debugging.

src/checks.c

index 4022cad58149a6aaa9850b9f1fd536074a900e36..40fb698ef9fb786ee194b995fb18d61660490301 100644 (file)
@@ -21,6 +21,7 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <arpa/inet.h>
 
 #include <common/compat.h>
@@ -677,6 +678,14 @@ struct task *process_chk(struct task *t)
                                }
 
                                if (s->result == SRV_CHK_UNKNOWN) {
+#ifdef TCP_QUICKACK
+                                       /* disabling tcp quick ack now allows
+                                        * the request to leave the machine with
+                                        * the first ACK.
+                                        */
+                                       if (s->proxy->options2 & PR_O2_SMARTCON)
+                                               setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
+#endif
                                        if ((connect(fd, (struct sockaddr *)&sa, sizeof(sa)) != -1) || (errno == EINPROGRESS)) {
                                                /* OK, connection in progress or established */