]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
* The 'retries' option was not used because the connect() could not return
authorwilly tarreau <willy@wtap.(none)>
Sun, 18 Dec 2005 00:37:12 +0000 (01:37 +0100)
committerwilly tarreau <willy@wtap.(none)>
Sun, 18 Dec 2005 00:37:12 +0000 (01:37 +0100)
  an error if the connection was refused before the the timeout. So the
  client was sent to the server anyway and then got its connection broken
  because of the write error. This is not a real problem with persistence,
  but it definitely is for new clients. This stupid bug must have been
  present for years !

haproxy.c

index 41c9820c406b835a9a16063c570a5ea226598ce3..f6529558f4614097daf2ad35b8aa33828747f247 100644 (file)
--- a/haproxy.c
+++ b/haproxy.c
@@ -2281,6 +2281,20 @@ int event_srv_write(int fd) {
     if (fdtab[fd].state != FD_STERROR) {
        if (max == 0) {
            /* may be we have received a connection acknowledgement in TCP mode without data */
+           if (s->srv_state == SV_STCONN) {
+               int skerr;
+               socklen_t lskerr = sizeof(skerr);
+               getsockopt(fd, SOL_SOCKET, SO_ERROR, &skerr, &lskerr);
+               if (skerr) {
+                   s->res_sw = RES_ERROR;
+                   fdtab[fd].state = FD_STERROR;
+                   task_wakeup(&rq, t);
+                   tv_eternity(&s->swexpire);
+                   FD_CLR(fd, StaticWriteEvent);
+                   return 0;
+               }
+           }
+
            s->res_sw = RES_NULL;
            task_wakeup(&rq, t);
            fdtab[fd].state = FD_STREADY;