mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
CLEANUP: task: remove unneeded tests before task_destroy()
Since previous commit it's not needed anymore to test a task pointer before calling task_destory() so let's just remove these tests from the various callers before they become confusing. The function's arguments were also documented. The same should probably be done with tasklet_free() which involves a test in roughly half of the call places.
This commit is contained in:
parent
75bc6d3e59
commit
f656279347
@ -329,6 +329,10 @@ static inline void __task_free(struct task *t)
|
|||||||
_HA_ATOMIC_SUB(&nb_tasks, 1);
|
_HA_ATOMIC_SUB(&nb_tasks, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Destroys a task : it's unlinked from the wait queues and is freed if it's
|
||||||
|
* the current task or not queued otherwise it's marked to be freed by the
|
||||||
|
* scheduler. It does nothing if <t> is NULL.
|
||||||
|
*/
|
||||||
static inline void task_destroy(struct task *t)
|
static inline void task_destroy(struct task *t)
|
||||||
{
|
{
|
||||||
if (!t)
|
if (!t)
|
||||||
|
|||||||
@ -3303,10 +3303,7 @@ int init_email_alert(struct mailers *mls, struct proxy *p, char **err)
|
|||||||
struct email_alertq *q = &queues[i];
|
struct email_alertq *q = &queues[i];
|
||||||
struct check *check = &q->check;
|
struct check *check = &q->check;
|
||||||
|
|
||||||
if (check->task) {
|
|
||||||
task_destroy(check->task);
|
task_destroy(check->task);
|
||||||
check->task = NULL;
|
|
||||||
}
|
|
||||||
free_check(check);
|
free_check(check);
|
||||||
}
|
}
|
||||||
free(queues);
|
free(queues);
|
||||||
|
|||||||
@ -1275,9 +1275,7 @@ spoe_release_appctx(struct appctx *appctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy the task attached to this applet */
|
/* Destroy the task attached to this applet */
|
||||||
if (spoe_appctx->task) {
|
|
||||||
task_destroy(spoe_appctx->task);
|
task_destroy(spoe_appctx->task);
|
||||||
}
|
|
||||||
|
|
||||||
/* Notify all waiting streams */
|
/* Notify all waiting streams */
|
||||||
list_for_each_entry_safe(ctx, back, &spoe_appctx->waiting_queue, list) {
|
list_for_each_entry_safe(ctx, back, &spoe_appctx->waiting_queue, list) {
|
||||||
|
|||||||
@ -2290,9 +2290,7 @@ void deinit(void)
|
|||||||
while (s) {
|
while (s) {
|
||||||
s_next = s->next;
|
s_next = s->next;
|
||||||
|
|
||||||
if (s->check.task)
|
|
||||||
task_destroy(s->check.task);
|
task_destroy(s->check.task);
|
||||||
if (s->agent.task)
|
|
||||||
task_destroy(s->agent.task);
|
task_destroy(s->agent.task);
|
||||||
|
|
||||||
if (s->check.wait_list.task)
|
if (s->check.wait_list.task)
|
||||||
@ -2300,7 +2298,6 @@ void deinit(void)
|
|||||||
if (s->agent.wait_list.task)
|
if (s->agent.wait_list.task)
|
||||||
tasklet_free(s->agent.wait_list.task);
|
tasklet_free(s->agent.wait_list.task);
|
||||||
|
|
||||||
if (s->warmup)
|
|
||||||
task_destroy(s->warmup);
|
task_destroy(s->warmup);
|
||||||
|
|
||||||
free(s->id);
|
free(s->id);
|
||||||
|
|||||||
@ -431,7 +431,6 @@ static int h1_init(struct connection *conn, struct proxy *proxy, struct session
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (t)
|
|
||||||
task_destroy(t);
|
task_destroy(t);
|
||||||
if (h1c->wait_event.task)
|
if (h1c->wait_event.task)
|
||||||
tasklet_free(h1c->wait_event.task);
|
tasklet_free(h1c->wait_event.task);
|
||||||
|
|||||||
@ -575,7 +575,6 @@ static int h2_init(struct connection *conn, struct proxy *prx, struct session *s
|
|||||||
fail_stream:
|
fail_stream:
|
||||||
hpack_dht_free(h2c->ddht);
|
hpack_dht_free(h2c->ddht);
|
||||||
fail:
|
fail:
|
||||||
if (t)
|
|
||||||
task_destroy(t);
|
task_destroy(t);
|
||||||
if (h2c->wait_event.task)
|
if (h2c->wait_event.task)
|
||||||
tasklet_free(h2c->wait_event.task);
|
tasklet_free(h2c->wait_event.task);
|
||||||
|
|||||||
@ -448,11 +448,8 @@ static int conn_complete_session(struct connection *conn)
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* the embryonic session's task is not needed anymore */
|
/* the embryonic session's task is not needed anymore */
|
||||||
if (sess->task) {
|
|
||||||
task_destroy(sess->task);
|
task_destroy(sess->task);
|
||||||
sess->task = NULL;
|
sess->task = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
conn_set_owner(conn, sess, conn_session_free);
|
conn_set_owner(conn, sess, conn_session_free);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user