MEDIUM: applet: centralize the call to si_applet_done() in the I/O handler

It's much easier to centralize this call into the I/O handler than to
do it everywhere with the risk to miss it. Applets are not allowed to
unregister themselves anyway so their SI is still present and it is
possible to update all the context.
This commit is contained in:
Willy Tarreau 2015-04-20 01:31:23 +02:00
parent b9c89111ab
commit d4da196546
4 changed files with 4 additions and 24 deletions

View File

@ -38,6 +38,6 @@ void applet_run_active()
}
curr->applet->fct(curr);
/* must not dereference curr nor si now because it might have been freed */
si_applet_done(si);
}
}

View File

@ -2429,13 +2429,6 @@ static void cli_io_handler(struct appctx *appctx)
}
out:
/* update all other flags and resync with the other side */
si_applet_done(si);
/* we don't want to expire timeouts while we're processing requests */
si_ic(si)->rex = TICK_ETERNITY;
si_oc(si)->wex = TICK_ETERNITY;
DPRINTF(stderr, "%s@%d: st=%d, rqf=%x, rpf=%x, rqh=%d, rqs=%d, rh=%d, rs=%d\n",
__FUNCTION__, __LINE__,
si->state, req->flags, res->flags, req->buf->i, req->buf->o, res->buf->i, res->buf->o);
@ -4961,14 +4954,8 @@ static void http_stats_io_handler(struct appctx *appctx)
res->flags |= CF_READ_NULL;
}
}
out:
/* update all other flags and resync with the other side */
si_applet_done(si);
/* we don't want to expire timeouts while we're processing requests */
si_ic(si)->rex = TICK_ETERNITY;
si_oc(si)->wex = TICK_ETERNITY;
/* just to make gcc happy */ ;
}

View File

@ -1446,11 +1446,11 @@ static void hlua_socket_handler(struct appctx *appctx)
si_ic(si)->flags |= CF_READ_NULL;
hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
hlua_com_wake(&appctx->ctx.hlua.wake_on_write);
goto leave;
return;
}
if (!(c->flags & CO_FL_CONNECTED))
goto leave;
return;
/* This function is called after the connect. */
appctx->ctx.hlua.connected = 1;
@ -1462,9 +1462,6 @@ static void hlua_socket_handler(struct appctx *appctx)
/* Wake the tasks which wants to read if the buffer contains data. */
if (channel_is_empty(si_ic(si)))
hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
leave:
si_applet_done(si);
}
/* This function is called when the "struct stream" is destroyed.

View File

@ -1043,11 +1043,7 @@ incomplete:
}
}
out:
si_applet_done(si);
si_oc(si)->flags |= CF_READ_DONTWAIT;
/* we don't want to expire timeouts while we're processing requests */
si_ic(si)->rex = TICK_ETERNITY;
si_oc(si)->wex = TICK_ETERNITY;
return;
full:
si->flags |= SI_FL_WAIT_ROOM;