]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] client timeout incorrectly rearmed while waiting for server
authorWilly Tarreau <w@1wt.eu>
Mon, 11 Aug 2008 09:20:03 +0000 (11:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 Aug 2008 09:34:18 +0000 (11:34 +0200)
Client timeout could be refreshed in stream_sock_*, but this is
undesired when the timeout is already set to eternity. The effect
is that a session could still be aborted if client timeout was
smaller than server timeout. A second effect is that sessions
expired on the server side would expire with "cD" flags.

The fix consists in not updating it if it was not previously set.
A cleaner method might consist in updating the buffer timeout. This
is probably what will be done later when the state machines only
deal with the buffers.

src/proto_http.c
src/stream_sock.c

index 9ddec24ac05c6b168d3420063d4120ffab2450fc..59d0479c82ec853dfb3ea38ec87ad1fc8b07a2c6 100644 (file)
@@ -2695,7 +2695,7 @@ int process_srv(struct session *t)
        int conn_err;
 
        DPRINTF(stderr,"process_srv: c=%s s=%s set(r,w)=%d,%d exp(r,w)=%u,%u\n",
-               cli_stnames[c], srv_stnames[s],
+               cli_stnames[t->cli_state], srv_stnames[t->srv_state],
                EV_FD_ISSET(t->srv_fd, DIR_RD), EV_FD_ISSET(t->srv_fd, DIR_WR),
                rep->rex, req->wex);
 
index 84bc2dbf505da687d6af4e1b86f9ad8183d1ac13..10688e940be0922fc6861dd9d6a0ed5bbd7299af 100644 (file)
@@ -217,7 +217,7 @@ int stream_sock_read(int fd) {
         * have at least read something.
         */
 
-       if (b->flags & BF_PARTIAL_READ)
+       if (b->rex && b->flags & BF_PARTIAL_READ)
                b->rex = tick_add_ifset(now_ms, b->rto);
 
  out_wakeup:
@@ -373,14 +373,14 @@ int stream_sock_write(int fd) {
         * written something.
         */
 
-       if (b->flags & BF_PARTIAL_WRITE) {
+       if (b->wex && b->flags & BF_PARTIAL_WRITE) {
                b->wex = tick_add_ifset(now_ms, b->wto);
                if (b->wex) {
                        /* FIXME: to prevent the client from expiring read timeouts during writes,
                         * we refresh it. A solution would be to merge read+write timeouts into a
                         * unique one, although that needs some study particularly on full-duplex
                         * TCP connections. */
-                       if (!(b->flags & BF_SHUTR_STATUS))
+                       if (b->rex && !(b->flags & BF_SHUTR_STATUS))
                                b->rex = b->wex;
                }
        }