mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: spoa-server: Allow registering external processes
Add struct for declaring an reistrering external processing resource.
This commit is contained in:
parent
786e9e684b
commit
64eaa33214
@ -97,6 +97,13 @@ static const char *spoe_frm_err_reasons[SPOE_FRM_ERRS] = {
|
|||||||
|
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
pthread_key_t worker_id;
|
pthread_key_t worker_id;
|
||||||
|
static struct ps *ps_list = NULL;
|
||||||
|
|
||||||
|
void ps_register(struct ps *ps)
|
||||||
|
{
|
||||||
|
ps->next = ps_list;
|
||||||
|
ps_list = ps;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_ipv4_reputation(struct worker *w, struct in_addr *ipv4)
|
check_ipv4_reputation(struct worker *w, struct in_addr *ipv4)
|
||||||
@ -925,10 +932,15 @@ spoa_worker(void *data)
|
|||||||
struct sockaddr_in client;
|
struct sockaddr_in client;
|
||||||
int *info = (int *)data;
|
int *info = (int *)data;
|
||||||
int csock, lsock = info[0];
|
int csock, lsock = info[0];
|
||||||
|
struct ps *ps;
|
||||||
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
pthread_setspecific(worker_id, &info[1]);
|
pthread_setspecific(worker_id, &info[1]);
|
||||||
|
|
||||||
|
/* Init registered processors */
|
||||||
|
for (ps = ps_list; ps != NULL; ps = ps->next)
|
||||||
|
ps->init_worker(&w);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
socklen_t sz = sizeof(client);
|
socklen_t sz = sizeof(client);
|
||||||
|
|
||||||
|
@ -80,9 +80,22 @@ struct spoe_data {
|
|||||||
union spoe_value u; /* spoe data value */
|
union spoe_value u; /* spoe data value */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct spoe_kv {
|
||||||
|
struct chunk name;
|
||||||
|
struct spoe_data value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ps {
|
||||||
|
struct ps *next;
|
||||||
|
char *ext;
|
||||||
|
int (*init_worker)(struct worker *w);
|
||||||
|
};
|
||||||
|
|
||||||
extern bool debug;
|
extern bool debug;
|
||||||
extern pthread_key_t worker_id;
|
extern pthread_key_t worker_id;
|
||||||
|
|
||||||
|
void ps_register(struct ps *ps);
|
||||||
|
|
||||||
#define LOG(fmt, args...) \
|
#define LOG(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
struct timeval now; \
|
struct timeval now; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user