* All situations where at least one of <expired> or CO_FL_ERROR are set
* produce a status.
*/
-static void chk_report_conn_err(struct connection *conn, int errno_bck, int expired)
+static void chk_report_conn_err(struct check *check, int errno_bck, int expired)
{
- struct check *check = conn->owner;
+ struct connection *conn = check->conn;
const char *err_msg;
struct chunk *chk;
int step;
return;
if (retrieve_errno_from_socket(conn)) {
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
__conn_data_stop_both(conn);
goto out_wakeup;
}
if (conn->flags & CO_FL_SOCK_WR_SH) {
/* if the output is closed, we can't do anything */
conn->flags |= CO_FL_ERROR;
- chk_report_conn_err(conn, 0, 0);
+ chk_report_conn_err(check, 0, 0);
goto out_wakeup;
}
if (check->bo->o) {
conn->xprt->snd_buf(conn, check->bo, 0);
if (conn->flags & CO_FL_ERROR) {
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
__conn_data_stop_both(conn);
goto out_wakeup;
}
* or not. It is very common that an RST sent by the server is
* reported as an error just after the last data chunk.
*/
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
goto out_wakeup;
}
}
out_wakeup:
/* collect possible new errors */
if (conn->flags & CO_FL_ERROR)
- chk_report_conn_err(conn, 0, 0);
+ chk_report_conn_err(check, 0, 0);
/* Reset the check buffer... */
*check->bi->data = '\0';
* main processing task so let's simply wake it up. If we get here,
* we expect errno to still be valid.
*/
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
__conn_data_stop_both(conn);
task_wakeup(check->task, TASK_WOKEN_IO);
case SF_ERR_SRVTO: /* ETIMEDOUT */
case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
conn->flags |= CO_FL_ERROR;
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
break;
case SF_ERR_PRXCOND:
case SF_ERR_RESOURCE:
case SF_ERR_INTERNAL:
conn->flags |= CO_FL_ERROR;
- chk_report_conn_err(conn, 0, 0);
+ chk_report_conn_err(check, 0, 0);
break;
}
case SF_ERR_SRVTO: /* ETIMEDOUT */
case SF_ERR_SRVCL: /* ECONNREFUSED, ENETUNREACH, ... */
conn->flags |= CO_FL_ERROR;
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
break;
/* should share same code than cases below */
case SF_ERR_CHK_PORT:
case SF_ERR_RESOURCE:
case SF_ERR_INTERNAL:
conn->flags |= CO_FL_ERROR;
- chk_report_conn_err(conn, 0, 0);
+ chk_report_conn_err(check, 0, 0);
break;
}
set_server_check_status(check, HCHK_STATUS_L4OK, NULL);
}
else if ((conn->flags & CO_FL_ERROR) || expired) {
- chk_report_conn_err(conn, 0, expired);
+ chk_report_conn_err(check, 0, expired);
}
else
goto out_wait; /* timeout not reached, wait again */
__conn_data_want_send(conn);
if (conn->xprt->snd_buf(conn, check->bo, 0) <= 0) {
if (conn->flags & CO_FL_ERROR) {
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
__conn_data_stop_both(conn);
goto out_end_tcpcheck;
}
if (conn->flags & CO_FL_SOCK_WR_SH) {
conn->flags |= CO_FL_ERROR;
- chk_report_conn_err(conn, 0, 0);
+ chk_report_conn_err(check, 0, 0);
goto out_end_tcpcheck;
}
* or not. It is very common that an RST sent by the server is
* reported as an error just after the last data chunk.
*/
- chk_report_conn_err(conn, errno, 0);
+ chk_report_conn_err(check, errno, 0);
goto out_end_tcpcheck;
}
}
out_end_tcpcheck:
/* collect possible new errors */
if (conn->flags & CO_FL_ERROR)
- chk_report_conn_err(conn, 0, 0);
+ chk_report_conn_err(check, 0, 0);
/* cleanup before leaving */
check->current_step = NULL;