[MAJOR] make unix sockets work again with stats
The unix protocol handler had not been updated during the last stream_sock changes. This has been done now. There is still a lot of duplicated code between session.c and proto_uxst.c due to the way the session is handled. Session.c relies on the existence of a frontend while it does not exist here. It is easier to see the difference between the stats part (placed in dumpstats.c) and the unix-stream part (in proto_uxst.c). The hijacking function still needs to be dynamically set into the response buffer, and some cleanup is still required, then all those changes should be forward-ported to the HTTP part. Adding support for new keywords should not cause trouble now.
This commit is contained in:
parent
ff8d42ea68
commit
b1356cf4e4
@ -39,7 +39,13 @@
|
||||
#define STATS_TYPE_BE 1
|
||||
#define STATS_TYPE_SV 2
|
||||
|
||||
#define STATS_ST_INIT 0
|
||||
#define STATS_ST_REQ 1
|
||||
#define STATS_ST_REP 2
|
||||
#define STATS_ST_CLOSE 3
|
||||
|
||||
int stats_dump_raw(struct session *s, struct uri_auth *uri);
|
||||
int stats_dump_raw_to_buffer(struct session *s, struct buffer *req);
|
||||
int stats_dump_http(struct session *s, struct uri_auth *uri);
|
||||
int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
int uxst_event_accept(int fd);
|
||||
void uxst_add_listener(struct listener *listener);
|
||||
void process_uxst_stats(struct task *t, int *next);
|
||||
void uxst_process_session(struct task *t, int *next);
|
||||
|
||||
#endif /* _PROTO_PROTO_UXST_H */
|
||||
|
||||
|
@ -78,7 +78,8 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
|
||||
global.stats_sock.state = LI_INIT;
|
||||
global.stats_sock.options = LI_O_NONE;
|
||||
global.stats_sock.accept = uxst_event_accept;
|
||||
global.stats_sock.handler = process_uxst_stats;
|
||||
global.stats_sock.handler = uxst_process_session;
|
||||
global.stats_sock.analysers = AN_REQ_UNIX_STATS;
|
||||
global.stats_sock.private = NULL;
|
||||
|
||||
cur_arg = 2;
|
||||
@ -287,6 +288,23 @@ int stats_dump_raw(struct session *s, struct uri_auth *uri)
|
||||
}
|
||||
|
||||
|
||||
/* This function is called to send output to the response buffer. It simply
|
||||
* calls stats_dump_raw(), and releases the buffer's hijack bit when the dump
|
||||
* is finished. It always returns 0.
|
||||
*/
|
||||
int stats_dump_raw_to_buffer(struct session *s, struct buffer *req)
|
||||
{
|
||||
if (s->ana_state != STATS_ST_REP)
|
||||
return 0;
|
||||
|
||||
if (stats_dump_raw(s, NULL) != 0) {
|
||||
buffer_stop_hijack(s->rep);
|
||||
s->ana_state = STATS_ST_CLOSE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Produces statistics data for the session <s>. Expects to be called with
|
||||
* client socket shut down on input. It stops by itself by unsetting the
|
||||
|
1280
src/proto_uxst.c
1280
src/proto_uxst.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user