]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: connection: remove the FD_POLL_* flags only once
authorWilly Tarreau <wtarreau@exceliance.fr>
Mon, 23 Jul 2012 10:14:26 +0000 (12:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 2 Sep 2012 19:51:28 +0000 (21:51 +0200)
It's inappropriate to remove FD_POLL_IN and FD_POLL_OUT in the IO callback
handlers, first because they shouldn't care about this, and second because
it will make it harder to chain multiple callers.

So let's flush these flags only once for all in the connection handler.
Right now, the HUP and ERR flags are still flushed in each IO handler to
avoid multiple calls. This will probably have to be fixed later.

src/connection.c
src/sock_raw.c

index 696525d3e9c947b41b1852f96cd66924c940e631..089ad892558cff2210019da3e574ed65b7714e07 100644 (file)
@@ -42,5 +42,7 @@ int conn_fd_handler(int fd)
                if (!conn->data->write(fd))
                        ret |= FD_WAIT_WRITE;
 
+       /* remove the events before leaving */
+       fdtab[fd].ev &= ~(FD_POLL_IN | FD_POLL_OUT | FD_POLL_HUP | FD_POLL_ERR);
        return ret;
 }
index 90081aa3387779ad008119e61dcf1db9f3e31157..ac0dbcde29dc6d8f421988ba4dbe35e6eb744d24 100644 (file)
@@ -484,7 +484,6 @@ static int sock_raw_read(int fd)
        if (b->flags & BF_READ_ACTIVITY)
                b->flags &= ~BF_READ_DONTWAIT;
 
-       fdtab[fd].ev &= ~FD_POLL_IN;
        return retval;
 
  out_shutdown_r:
@@ -741,7 +740,6 @@ static int sock_raw_write(int fd)
                        task_wakeup(si->owner, TASK_WOKEN_IO);
        }
 
-       fdtab[fd].ev &= ~FD_POLL_OUT;
        return retval;
 
  out_error: