MAJOR: spoe: refactor the filter to clean up the code

The SPOE code is now pretty big and it was the good time to clean it up. It is
not perfect, some parts remains a bit ugly. But it is far better now.
This commit is contained in:
Christopher Faulet 2017-02-20 22:56:03 +01:00 committed by Willy Tarreau
parent 850103546c
commit 8ef75251e3
4 changed files with 1230 additions and 1083 deletions

View File

@ -52,8 +52,8 @@ void send_email_alert(struct server *s, int priority, const char *format, ...)
int srv_check_healthcheck_port(struct check *chk);
/* Declared here, but the definitions are in flt_spoe.c */
int prepare_spoe_healthcheck_request(char **req, int *len);
int handle_spoe_healthcheck_response(char *frame, size_t size, char *err, int errlen);
int spoe_prepare_healthcheck_request(char **req, int *len);
int spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen);
#endif /* _PROTO_CHECKS_H */

View File

@ -4921,7 +4921,7 @@ stats_error_parsing:
curproxy->options2 &= ~PR_O2_CHK_ANY;
curproxy->options2 |= PR_O2_SPOP_CHK;
if (prepare_spoe_healthcheck_request(&curproxy->check_req, &curproxy->check_len)) {
if (spoe_prepare_healthcheck_request(&curproxy->check_req, &curproxy->check_len)) {
Alert("parsing [%s:%d] : failed to prepare SPOP healthcheck request.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;

View File

@ -1328,7 +1328,7 @@ static void event_srv_chk_r(struct connection *conn)
if (!done && check->bi->i < (4+framesz))
goto wait_more_data;
if (!handle_spoe_healthcheck_response(check->bi->data+4, framesz, err, HCHK_DESC_LEN-1))
if (!spoe_handle_healthcheck_response(check->bi->data+4, framesz, err, HCHK_DESC_LEN-1))
set_server_check_status(check, HCHK_STATUS_L7OKD, "SPOA server is ok");
else
set_server_check_status(check, HCHK_STATUS_L7STS, err);

File diff suppressed because it is too large Load Diff