CLEANUP: checks: Reorg checks.c file to be more readable
The patch is not obvious at the first glance. But it is just a reorg. Functions have been grouped and ordered in a more logical way. Some structures and flags are now private to the checks module (so moved from the .h to the .c file).
This commit is contained in:
parent
a32a2504b1
commit
61cc852230
|
@ -32,8 +32,6 @@ const char *get_check_status_description(short check_status);
|
||||||
const char *get_check_status_info(short check_status);
|
const char *get_check_status_info(short check_status);
|
||||||
void __health_adjust(struct server *s, short status);
|
void __health_adjust(struct server *s, short status);
|
||||||
|
|
||||||
extern struct data_cb check_conn_cb;
|
|
||||||
|
|
||||||
/* Use this one only. This inline version only ensures that we don't
|
/* Use this one only. This inline version only ensures that we don't
|
||||||
* call the function when the observe mode is disabled.
|
* call the function when the observe mode is disabled.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -81,35 +81,6 @@ enum healthcheck_status {
|
||||||
HCHK_STATUS_SIZE
|
HCHK_STATUS_SIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* environment variables memory requirement for different types of data */
|
|
||||||
#define EXTCHK_SIZE_EVAL_INIT 0 /* size determined during the init phase,
|
|
||||||
* such environment variables are not updatable. */
|
|
||||||
#define EXTCHK_SIZE_ULONG 20 /* max string length for an unsigned long value */
|
|
||||||
#define EXTCHK_SIZE_UINT 11 /* max string length for an unsigned int value */
|
|
||||||
#define EXTCHK_SIZE_ADDR INET6_ADDRSTRLEN+1 /* max string length for an address */
|
|
||||||
|
|
||||||
/* external checks environment variables */
|
|
||||||
enum {
|
|
||||||
EXTCHK_PATH = 0,
|
|
||||||
|
|
||||||
/* Proxy specific environment variables */
|
|
||||||
EXTCHK_HAPROXY_PROXY_NAME, /* the backend name */
|
|
||||||
EXTCHK_HAPROXY_PROXY_ID, /* the backend id */
|
|
||||||
EXTCHK_HAPROXY_PROXY_ADDR, /* the first bind address if available (or empty) */
|
|
||||||
EXTCHK_HAPROXY_PROXY_PORT, /* the first bind port if available (or empty) */
|
|
||||||
|
|
||||||
/* Server specific environment variables */
|
|
||||||
EXTCHK_HAPROXY_SERVER_NAME, /* the server name */
|
|
||||||
EXTCHK_HAPROXY_SERVER_ID, /* the server id */
|
|
||||||
EXTCHK_HAPROXY_SERVER_ADDR, /* the server address */
|
|
||||||
EXTCHK_HAPROXY_SERVER_PORT, /* the server port if available (or empty) */
|
|
||||||
EXTCHK_HAPROXY_SERVER_MAXCONN, /* the server max connections */
|
|
||||||
EXTCHK_HAPROXY_SERVER_CURCONN, /* the current number of connections on the server */
|
|
||||||
|
|
||||||
EXTCHK_SIZE
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* health status for response tracking */
|
/* health status for response tracking */
|
||||||
enum {
|
enum {
|
||||||
HANA_STATUS_UNKNOWN = 0,
|
HANA_STATUS_UNKNOWN = 0,
|
||||||
|
@ -195,22 +166,6 @@ struct check {
|
||||||
int via_socks4; /* check the connection via socks4 proxy */
|
int via_socks4; /* check the connection via socks4 proxy */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct check_status {
|
|
||||||
short result; /* one of SRV_CHK_* */
|
|
||||||
char *info; /* human readable short info */
|
|
||||||
char *desc; /* long description */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct extcheck_env {
|
|
||||||
char *name; /* environment variable name */
|
|
||||||
int vmaxlen; /* value maximum length, used to determine the required memory allocation */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct analyze_status {
|
|
||||||
char *desc; /* description */
|
|
||||||
unsigned char lr[HANA_OBS_SIZE]; /* result for l4/l7: 0 = ignore, 1 - error, 2 - OK */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define TCPCHK_OPT_NONE 0x0000 /* no options specified, default */
|
#define TCPCHK_OPT_NONE 0x0000 /* no options specified, default */
|
||||||
#define TCPCHK_OPT_SEND_PROXY 0x0001 /* send proxy-protocol string */
|
#define TCPCHK_OPT_SEND_PROXY 0x0001 /* send proxy-protocol string */
|
||||||
#define TCPCHK_OPT_SSL 0x0002 /* SSL connection */
|
#define TCPCHK_OPT_SSL 0x0002 /* SSL connection */
|
||||||
|
|
6202
src/checks.c
6202
src/checks.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue