*/
struct idle_conns {
struct mt_list toremove_conns;
- __decl_thread(HA_SPINLOCK_T toremove_lock);
+ __decl_thread(HA_SPINLOCK_T takeover_lock);
struct task *cleanup_task;
} THREAD_ALIGNED(64);
}
conn_force_unsubscribe(conn);
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
MT_LIST_DEL((struct mt_list *)&conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
pool_free(pool_head_connection, conn);
}
* to end up with two threads using the same connection.
*/
i = tid;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
conn = MT_LIST_POP(&mt_list[tid], struct connection *, list);
/* If we failed to pick a connection from the idle list, let's try again with
mt_list = srv->safe_conns;
}
}
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
/* If we found a connection in our own list, and we don't have to
* steal one from another thread, then we're done.
if (!srv->curr_idle_thr[i] || i == tid)
continue;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
mt_list_for_each_entry_safe(conn, &mt_list[i], list, elt1, elt2) {
if (conn->mux->takeover && conn->mux->takeover(conn) == 0) {
MT_LIST_DEL_SAFE(elt1);
}
}
}
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
}
if (!found)
// see it possibly larger.
ALREADY_CHECKED(i);
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
tokill_conn = MT_LIST_POP(&srv->idle_conns[i],
struct connection *, list);
if (!tokill_conn)
MT_LIST_ADDQ(&idle_conns[i].toremove_conns,
(struct mt_list *)&tokill_conn->list);
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
break;
}
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
}
}
goto err;
idle_conns[i].cleanup_task->process = srv_cleanup_toremove_connections;
idle_conns[i].cleanup_task->context = NULL;
- HA_SPIN_INIT(&idle_conns[i].toremove_lock);
+ HA_SPIN_INIT(&idle_conns[i].takeover_lock);
MT_LIST_INIT(&idle_conns[i].toremove_conns);
}
}
int ret = 0;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (tl->context == NULL) {
/* The connection has been taken over by another thread,
* we're no longer responsible for it, so just free the
* tasklet, and do nothing.
*/
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
tasklet_free(tl);
return NULL;
if (conn_in_list)
MT_LIST_DEL(&conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (!(fconn->wait_event.events & SUB_RETRY_SEND))
ret = fcgi_send(fconn);
/* 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);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (fconn->conn->flags & CO_FL_LIST_MASK)
MT_LIST_DEL(&fconn->conn->list);
if (!t->context)
fconn = NULL;
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
}
task_destroy(t);
int ret = 0;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (tl->context == NULL) {
/* The connection has been taken over by another thread,
* we're no longer responsible for it, so just free the
* tasklet, and do nothing.
*/
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
tasklet_free(tl);
return NULL;
}
if (conn_in_list)
MT_LIST_DEL(&conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (!(h1c->wait_event.events & SUB_RETRY_SEND))
ret = h1_send(h1c);
/* 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);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (h1c->conn->flags & CO_FL_LIST_MASK)
MT_LIST_DEL(&h1c->conn->list);
if (!t->context)
h1c = NULL;
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
}
task_destroy(t);
int ret = 0;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (t->context == NULL) {
/* The connection has been taken over by another thread,
* we're no longer responsible for it, so just free the
* tasklet, and do nothing.
*/
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
tasklet_free(tl);
goto leave;
}
if (conn_in_list)
MT_LIST_DEL(&conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (!(h2c->wait_event.events & SUB_RETRY_SEND))
ret = h2_send(h2c);
}
/* connections in error must be removed from the idle lists */
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
MT_LIST_DEL((struct mt_list *)&conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
}
else if (h2c->st0 == H2_CS_ERROR) {
/* connections in error must be removed from the idle lists */
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
MT_LIST_DEL((struct mt_list *)&conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
}
if (!b_data(&h2c->dbuf))
/* 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);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
if (h2c->conn->flags & CO_FL_LIST_MASK)
MT_LIST_DEL(&h2c->conn->list);
if (!t->context)
h2c = NULL;
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
}
task_destroy(t);
}
/* in any case this connection must not be considered idle anymore */
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
MT_LIST_DEL((struct mt_list *)&h2c->conn->list);
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].takeover_lock);
/* either we can release everything now or it will be done later once
* the last stream closes.
HA_SPIN_LOCK(OTHER_LOCK, &idle_conn_srv_lock);
for (i = tid;;) {
did_remove = 0;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
for (j = 0; j < srv->curr_idle_conns; j++) {
conn = MT_LIST_POP(&srv->idle_conns[i], struct connection *, list);
if (!conn)
did_remove = 1;
MT_LIST_ADDQ(&idle_conns[i].toremove_conns, (struct mt_list *)&conn->list);
}
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
if (did_remove)
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
max_conn = (exceed_conns * srv->curr_idle_thr[i]) /
curr_idle + 1;
- HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].toremove_lock);
+ HA_SPIN_LOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
for (j = 0; j < max_conn; j++) {
struct connection *conn = MT_LIST_POP(&srv->idle_conns[i], struct connection *, list);
if (!conn)
did_remove = 1;
MT_LIST_ADDQ(&idle_conns[i].toremove_conns, (struct mt_list *)&conn->list);
}
- HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].toremove_lock);
+ HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[i].takeover_lock);
if (did_remove && max_conn < srv->curr_idle_thr[i])
srv_is_empty = 0;
if (did_remove)