mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-26 14:42:21 +00:00
MINOR: checks/obj_type: Add a new object type for checks
An object type is now affected to the check structure.
This commit is contained in:
parent
f9585d8dc7
commit
3829046893
@ -32,6 +32,7 @@
|
||||
#include <types/server.h>
|
||||
#include <types/stream.h>
|
||||
#include <types/stream_interface.h>
|
||||
#include <types/checks.h>
|
||||
|
||||
static inline enum obj_type obj_type(const enum obj_type *t)
|
||||
{
|
||||
@ -53,6 +54,7 @@ static inline const char *obj_type_name(const enum obj_type *t)
|
||||
case OBJ_TYPE_SRVRQ: return "SRVRQ";
|
||||
case OBJ_TYPE_CS: return "CS";
|
||||
case OBJ_TYPE_STREAM: return "STREAM";
|
||||
case OBJ_TYPE_CHECK: return "CHECK";
|
||||
default: return "!INVAL!";
|
||||
}
|
||||
}
|
||||
@ -172,6 +174,18 @@ static inline struct stream *objt_stream(enum obj_type *t)
|
||||
return __objt_stream(t);
|
||||
}
|
||||
|
||||
static inline struct check *__objt_check(enum obj_type *t)
|
||||
{
|
||||
return container_of(t, struct check, obj_type);
|
||||
}
|
||||
|
||||
static inline struct check *objt_check(enum obj_type *t)
|
||||
{
|
||||
if (!t || *t != OBJ_TYPE_CHECK)
|
||||
return NULL;
|
||||
return __objt_check(t);
|
||||
}
|
||||
|
||||
static inline void *obj_base_ptr(enum obj_type *t)
|
||||
{
|
||||
switch (obj_type(t)) {
|
||||
@ -184,6 +198,7 @@ static inline void *obj_base_ptr(enum obj_type *t)
|
||||
case OBJ_TYPE_CONN: return __objt_conn(t);
|
||||
case OBJ_TYPE_SRVRQ: return __objt_dns_srvrq(t);
|
||||
case OBJ_TYPE_CS: return __objt_cs(t);
|
||||
case OBJ_TYPE_CHECK: return __objt_check(t);
|
||||
default: return t; // exact pointer for invalid case
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,7 @@ enum {
|
||||
};
|
||||
|
||||
struct check {
|
||||
enum obj_type obj_type; /* object type == OBJ_TYPE_CHECK */
|
||||
struct session *sess; /* Health check session. */
|
||||
struct vars vars; /* Health check dynamic variables. */
|
||||
struct xprt_ops *xprt; /* transport layer operations for health checks */
|
||||
|
@ -42,6 +42,7 @@ enum obj_type {
|
||||
OBJ_TYPE_SRVRQ, /* object is a struct dns_srvrq */
|
||||
OBJ_TYPE_CS, /* object is a struct conn_stream */
|
||||
OBJ_TYPE_STREAM, /* object is a struct stream */
|
||||
OBJ_TYPE_CHECK, /* object is a struct check */
|
||||
OBJ_TYPE_ENTRIES /* last one : number of entries */
|
||||
} __attribute__((packed)) ;
|
||||
|
||||
|
@ -1758,11 +1758,13 @@ struct server *new_server(struct proxy *proxy)
|
||||
srv->next_state = SRV_ST_RUNNING; /* early server setup */
|
||||
srv->last_change = now.tv_sec;
|
||||
|
||||
srv->check.obj_type = OBJ_TYPE_CHECK;
|
||||
srv->check.status = HCHK_STATUS_INI;
|
||||
srv->check.server = srv;
|
||||
srv->check.proxy = proxy;
|
||||
srv->check.tcpcheck_rules = &proxy->tcpcheck_rules;
|
||||
|
||||
srv->agent.obj_type = OBJ_TYPE_CHECK;
|
||||
srv->agent.status = HCHK_STATUS_INI;
|
||||
srv->agent.server = srv;
|
||||
srv->agent.proxy = proxy;
|
||||
|
Loading…
Reference in New Issue
Block a user