aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordemon <demon@FreeBSD.org>2017-03-12 16:56:36 +0800
committerdemon <demon@FreeBSD.org>2017-03-12 16:56:36 +0800
commitfd71f387e792512d75833abb47e56647979952e3 (patch)
tree7879ce8a225af025f2348708584fb720e6b98b15
parent040f0b260e671616889ef23ed51708836c495b52 (diff)
downloadfreebsd-ports-gnome-fd71f387e792512d75833abb47e56647979952e3.tar.gz
freebsd-ports-gnome-fd71f387e792512d75833abb47e56647979952e3.tar.zst
freebsd-ports-gnome-fd71f387e792512d75833abb47e56647979952e3.zip
Add a temporary patch to fix timeouts reported at haproxy ML.
Obtained from: haproxy ML
-rw-r--r--net/haproxy/Makefile1
-rw-r--r--net/haproxy/files/patch-src-proto_tcp.c60
2 files changed, 61 insertions, 0 deletions
diff --git a/net/haproxy/Makefile b/net/haproxy/Makefile
index 44b1fd5b7057..69b2c15f4bd9 100644
--- a/net/haproxy/Makefile
+++ b/net/haproxy/Makefile
@@ -3,6 +3,7 @@
PORTNAME= haproxy
PORTVERSION= 1.7.3
+PORTREVISION= 1
CATEGORIES= net www
MASTER_SITES= http://www.haproxy.org/download/1.7/src/
DISTFILES= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}
diff --git a/net/haproxy/files/patch-src-proto_tcp.c b/net/haproxy/files/patch-src-proto_tcp.c
new file mode 100644
index 000000000000..ad485de2fc62
--- /dev/null
+++ b/net/haproxy/files/patch-src-proto_tcp.c
@@ -0,0 +1,60 @@
+--- src/proto_tcp.c.orig 2017-02-28 11:59:23.000000000 +0300
++++ src/proto_tcp.c 2017-03-12 11:55:08.528932000 +0300
+@@ -474,16 +474,10 @@ int tcp_connect_server(struct connection
+ if (global.tune.server_rcvbuf)
+ setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &global.tune.server_rcvbuf, sizeof(global.tune.server_rcvbuf));
+
+- if (connect(fd, (struct sockaddr *)&conn->addr.to, get_addr_len(&conn->addr.to)) == -1) {
+- if (errno == EINPROGRESS || errno == EALREADY) {
+- /* common case, let's wait for connect status */
+- conn->flags |= CO_FL_WAIT_L4_CONN;
+- }
+- else if (errno == EISCONN) {
+- /* should normally not happen but if so, indicates that it's OK */
+- conn->flags &= ~CO_FL_WAIT_L4_CONN;
+- }
+- else if (errno == EAGAIN || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
++ if ((connect(fd, (struct sockaddr *)&conn->addr.to, get_addr_len(&conn->addr.to)) == -1) &&
++ (errno != EINPROGRESS) && (errno != EALREADY) && (errno != EISCONN)) {
++
++ if (errno == EAGAIN || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
+ char *msg;
+ if (errno == EAGAIN || errno == EADDRNOTAVAIL) {
+ msg = "no free ports";
+@@ -520,10 +514,6 @@ int tcp_connect_server(struct connection
+ return SF_ERR_SRVCL;
+ }
+ }
+- else {
+- /* connect() == 0, this is great! */
+- conn->flags &= ~CO_FL_WAIT_L4_CONN;
+- }
+
+ conn->flags |= CO_FL_ADDR_TO_SET;
+
+@@ -533,6 +523,7 @@ int tcp_connect_server(struct connection
+
+ conn_ctrl_init(conn); /* registers the FD */
+ fdtab[fd].linger_risk = 1; /* close hard if needed */
++ conn_sock_want_send(conn); /* for connect status */
+
+ if (conn_xprt_init(conn) < 0) {
+ conn_force_close(conn);
+@@ -540,17 +531,6 @@ int tcp_connect_server(struct connection
+ return SF_ERR_RESOURCE;
+ }
+
+- if (conn->flags & (CO_FL_HANDSHAKE | CO_FL_WAIT_L4_CONN)) {
+- conn_sock_want_send(conn); /* for connect status, proxy protocol or SSL */
+- }
+- else {
+- /* If there's no more handshake, we need to notify the data
+- * layer when the connection is already OK otherwise we'll have
+- * no other opportunity to do it later (eg: health checks).
+- */
+- data = 1;
+- }
+-
+ if (data)
+ conn_data_want_send(conn); /* prepare to send data if any */
+