mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-11 03:31:36 +00:00
CLEANUP: applet: rename all occurrences of stconn "cs" to "sc"
Function arguments and local variables called "cs" were renamed to "sc" to avoid future confusion.
This commit is contained in:
parent
475e4636bc
commit
07ee044762
40
src/applet.c
40
src/applet.c
@ -164,21 +164,21 @@ void appctx_shut(struct appctx *appctx)
|
|||||||
int appctx_buf_available(void *arg)
|
int appctx_buf_available(void *arg)
|
||||||
{
|
{
|
||||||
struct appctx *appctx = arg;
|
struct appctx *appctx = arg;
|
||||||
struct stconn *cs = appctx_cs(appctx);
|
struct stconn *sc = appctx_cs(appctx);
|
||||||
|
|
||||||
/* allocation requested ? */
|
/* allocation requested ? */
|
||||||
if (!(cs->flags & SC_FL_NEED_BUFF))
|
if (!(sc->flags & SC_FL_NEED_BUFF))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sc_have_buff(cs);
|
sc_have_buff(sc);
|
||||||
|
|
||||||
/* was already allocated another way ? if so, don't take this one */
|
/* was already allocated another way ? if so, don't take this one */
|
||||||
if (c_size(sc_ic(cs)) || sc_ic(cs)->pipe)
|
if (c_size(sc_ic(sc)) || sc_ic(sc)->pipe)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* allocation possible now ? */
|
/* allocation possible now ? */
|
||||||
if (!b_alloc(&sc_ic(cs)->buf)) {
|
if (!b_alloc(&sc_ic(sc)->buf)) {
|
||||||
sc_need_buff(cs);
|
sc_need_buff(sc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ int appctx_buf_available(void *arg)
|
|||||||
struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
||||||
{
|
{
|
||||||
struct appctx *app = context;
|
struct appctx *app = context;
|
||||||
struct stconn *cs;
|
struct stconn *sc;
|
||||||
unsigned int rate;
|
unsigned int rate;
|
||||||
size_t count;
|
size_t count;
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
|||||||
BUG_ON(!app->sess || !appctx_cs(app) || !appctx_strm(app));
|
BUG_ON(!app->sess || !appctx_cs(app) || !appctx_strm(app));
|
||||||
}
|
}
|
||||||
|
|
||||||
cs = appctx_cs(app);
|
sc = appctx_cs(app);
|
||||||
|
|
||||||
/* We always pretend the applet can't get and doesn't want to
|
/* We always pretend the applet can't get and doesn't want to
|
||||||
* put, it's up to it to change this if needed. This ensures
|
* put, it's up to it to change this if needed. This ensures
|
||||||
@ -227,32 +227,32 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
|
|||||||
* some other processing if needed. The applet doesn't have anything to
|
* some other processing if needed. The applet doesn't have anything to
|
||||||
* do if it needs the buffer, it will be called again upon readiness.
|
* do if it needs the buffer, it will be called again upon readiness.
|
||||||
*/
|
*/
|
||||||
if (!sc_alloc_ibuf(cs, &app->buffer_wait))
|
if (!sc_alloc_ibuf(sc, &app->buffer_wait))
|
||||||
applet_have_more_data(app);
|
applet_have_more_data(app);
|
||||||
|
|
||||||
count = co_data(sc_oc(cs));
|
count = co_data(sc_oc(sc));
|
||||||
app->applet->fct(app);
|
app->applet->fct(app);
|
||||||
|
|
||||||
/* now check if the applet has released some room and forgot to
|
/* now check if the applet has released some room and forgot to
|
||||||
* notify the other side about it.
|
* notify the other side about it.
|
||||||
*/
|
*/
|
||||||
if (count != co_data(sc_oc(cs))) {
|
if (count != co_data(sc_oc(sc))) {
|
||||||
sc_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
|
sc_oc(sc)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
|
||||||
sc_have_room(sc_opposite(cs));
|
sc_have_room(sc_opposite(sc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* measure the call rate and check for anomalies when too high */
|
/* measure the call rate and check for anomalies when too high */
|
||||||
rate = update_freq_ctr(&app->call_rate, 1);
|
rate = update_freq_ctr(&app->call_rate, 1);
|
||||||
if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second
|
if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second
|
||||||
((b_size(sc_ib(cs)) && cs->flags & SC_FL_NEED_ROOM) || // asks for a buffer which is present
|
((b_size(sc_ib(sc)) && sc->flags & SC_FL_NEED_ROOM) || // asks for a buffer which is present
|
||||||
(b_size(sc_ib(cs)) && !b_data(sc_ib(cs)) && cs->flags & SC_FL_NEED_ROOM) || // asks for room in an empty buffer
|
(b_size(sc_ib(sc)) && !b_data(sc_ib(sc)) && sc->flags & SC_FL_NEED_ROOM) || // asks for room in an empty buffer
|
||||||
(b_data(sc_ob(cs)) && sc_is_send_allowed(cs)) || // asks for data already present
|
(b_data(sc_ob(sc)) && sc_is_send_allowed(sc)) || // asks for data already present
|
||||||
(!b_data(sc_ib(cs)) && b_data(sc_ob(cs)) && // didn't return anything ...
|
(!b_data(sc_ib(sc)) && b_data(sc_ob(sc)) && // didn't return anything ...
|
||||||
(sc_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
|
(sc_oc(sc)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
|
||||||
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
|
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
|
||||||
}
|
}
|
||||||
|
|
||||||
cs->app_ops->wake(cs);
|
sc->app_ops->wake(sc);
|
||||||
channel_release_buffer(sc_ic(cs), &app->buffer_wait);
|
channel_release_buffer(sc_ic(sc), &app->buffer_wait);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user