}
}
- SPIN_LOCK(SERVER_LOCK, &check->server->lock);
if (check->state & CHK_ST_PORT_MISS) {
/* NOTE: this is reported after <fall> tries */
chunk_printf(chk, "No port available for the TCP connection");
else /* HTTP, SMTP, ... */
set_server_check_status(check, HCHK_STATUS_L7TOUT, err_msg);
}
- SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return;
}
struct server *s = check->server;
struct task *t = check->task;
+ SPIN_LOCK(SERVER_LOCK, &check->server->lock);
if (unlikely(check->result == CHK_RES_FAILED))
goto out_wakeup;
__cs_stop_both(cs);
goto out_wakeup;
}
- if (check->bo->o)
+ if (check->bo->o) {
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return;
+ }
}
/* full request sent, we allow up to <timeout.check> if nonzero for a response */
out_wakeup:
task_wakeup(t, TASK_WOKEN_IO);
out_nowake:
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
__cs_stop_send(cs); /* nothing more to write */
}
break;
} /* switch */
- SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
out_wakeup:
/* collect possible new errors */
if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR)
conn->flags |= CO_FL_ERROR;
task_wakeup(t, TASK_WOKEN_IO);
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return;
wait_more_data:
__cs_want_recv(cs);
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
}
/*
struct check *check = cs->data;
int ret = 0;
+ SPIN_LOCK(SERVER_LOCK, &check->server->lock);
+
/* we may have to make progress on the TCP checks */
if (check->type == PR_O2_TCPCHK_CHK) {
ret = tcpcheck_main(check);
ret = -1;
}
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
+
/* if a connection got replaced, we must absolutely prevent the connection
* handler from touching its fd, and perform the FD polling updates ourselves
*/
int ret;
int expired = tick_is_expired(t->expire, now_ms);
+ SPIN_LOCK(SERVER_LOCK, &check->server->lock);
if (!(check->state & CHK_ST_INPROGRESS)) {
/* no check currently running */
- if (!expired) /* woke up too early */
+ if (!expired) { /* woke up too early */
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return t;
+ }
/* we don't send any health-checks when the proxy is
* stopped, the server should not be checked or the check
reschedule:
while (tick_is_expired(t->expire, now_ms))
t->expire = tick_add(t->expire, MS_TO_TICKS(check->inter));
+ SPIN_LOCK(SERVER_LOCK, &check->server->lock);
return t;
}
int ret;
int expired = tick_is_expired(t->expire, now_ms);
+ SPIN_LOCK(SERVER_LOCK, &check->server->lock);
if (!(check->state & CHK_ST_INPROGRESS)) {
/* no check currently running */
- if (!expired) /* woke up too early */
+ if (!expired) { /* woke up too early */
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return t;
+ }
/* we don't send any health-checks when the proxy is
* stopped, the server should not be checked or the check
while (tick_is_expired(t->expire, now_ms))
t->expire = tick_add(t->expire, MS_TO_TICKS(check->inter));
out_wait:
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return t;
}
struct list *head = check->tcpcheck_rules;
int retcode = 0;
+ SPIN_LOCK(SERVER_LOCK, &check->server->lock);
+
/* here, we know that the check is complete or that it failed */
if (check->result != CHK_RES_UNKNOWN)
goto out_end_tcpcheck;
if (s->proxy->timeout.check)
t->expire = tick_first(t->expire, t_con);
}
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return retcode;
}
chunk_appendf(&trash, " comment: '%s'", comment);
set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
check->current_step = NULL;
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return retcode;
}
if (&check->current_step->list != head &&
check->current_step->action == TCPCHK_ACT_EXPECT)
__cs_want_recv(cs);
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return retcode;
out_end_tcpcheck:
conn->flags |= CO_FL_ERROR;
__cs_stop_both(cs);
+ SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
return retcode;
}