mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-27 09:06:46 -04:00
MINOR: mux-h1: avoid taking the toremove_lock in on dying tasks
If the owning task is already dying (context was destroyed by h1_takeover) there's no point taking the lock then removing it later since all the code in between is conditionned by a non-null context. Let's simplify this.
This commit is contained in:
parent
1553b6657d
commit
68d4ee9e26
1 changed files with 21 additions and 19 deletions
40
src/mux_h1.c
40
src/mux_h1.c
|
|
@ -2300,27 +2300,29 @@ static struct task *h1_timeout_task(struct task *t, void *context, unsigned shor
|
|||
|
||||
TRACE_POINT(H1_EV_H1C_WAKE, h1c ? h1c->conn : NULL);
|
||||
|
||||
if (!expired && h1c) {
|
||||
TRACE_DEVEL("leaving (not expired)", H1_EV_H1C_WAKE, h1c->conn);
|
||||
return t;
|
||||
if (h1c) {
|
||||
if (!expired) {
|
||||
TRACE_DEVEL("leaving (not expired)", H1_EV_H1C_WAKE, h1c->conn);
|
||||
return t;
|
||||
}
|
||||
|
||||
/* We're about to destroy the connection, so make sure nobody attempts
|
||||
* to steal it from us.
|
||||
*/
|
||||
HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
|
||||
|
||||
if (h1c->conn->flags & CO_FL_LIST_MASK)
|
||||
MT_LIST_DEL(&h1c->conn->list);
|
||||
|
||||
/* Somebody already stole the connection from us, so we should not
|
||||
* free it, we just have to free the task.
|
||||
*/
|
||||
if (!t->context)
|
||||
h1c = NULL;
|
||||
|
||||
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
|
||||
}
|
||||
|
||||
/* We're about to destroy the connection, so make sure nobody attempts
|
||||
* to steal it from us.
|
||||
*/
|
||||
HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
|
||||
|
||||
if (h1c && h1c->conn->flags & CO_FL_LIST_MASK)
|
||||
MT_LIST_DEL(&h1c->conn->list);
|
||||
|
||||
/* Somebody already stole the connection from us, so we should not
|
||||
* free it, we just have to free the task.
|
||||
*/
|
||||
if (!t->context)
|
||||
h1c = NULL;
|
||||
|
||||
HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
|
||||
|
||||
task_destroy(t);
|
||||
|
||||
if (!h1c) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue