[OPTIM] stream_sock: don't clear FDs that are already cleared

We can on average two calls to __fd_clr() per session by avoiding to
call it unnecessarily.
This commit is contained in:
Willy Tarreau 2010-11-11 23:08:17 +01:00
parent 2f976e18b8
commit 11f49408f2
1 changed files with 12 additions and 8 deletions

View File

@ -938,11 +938,13 @@ void stream_sock_data_finish(struct stream_interface *si)
/* Read not closed, update FD status and timeout for reads */
if (ib->flags & (BF_FULL|BF_HIJACK|BF_DONT_READ)) {
/* stop reading */
if (!(si->flags & SI_FL_WAIT_ROOM)) {
if ((ib->flags & (BF_FULL|BF_HIJACK|BF_DONT_READ)) == BF_FULL)
si->flags |= SI_FL_WAIT_ROOM;
EV_FD_COND_C(fd, DIR_RD);
ib->rex = TICK_ETERNITY;
}
}
else {
/* (re)start reading and update timeout. Note: we don't recompute the timeout
* everytime we get here, otherwise it would risk never to expire. We only
@ -961,11 +963,13 @@ void stream_sock_data_finish(struct stream_interface *si)
/* Write not closed, update FD status and timeout for writes */
if (ob->flags & BF_OUT_EMPTY) {
/* stop writing */
if (!(si->flags & SI_FL_WAIT_DATA)) {
if ((ob->flags & (BF_FULL|BF_HIJACK|BF_SHUTW_NOW)) == 0)
si->flags |= SI_FL_WAIT_DATA;
EV_FD_COND_C(fd, DIR_WR);
ob->wex = TICK_ETERNITY;
}
}
else {
/* (re)start writing and update timeout. Note: we don't recompute the timeout
* everytime we get here, otherwise it would risk never to expire. We only