mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
CLEANUP: server: Rename state_line structure into server_state_line
The structure used to store a server-state line in an eb-tree has a too generic name. Instead of state_line, the structure is renamed as server_state_line.
This commit is contained in:
parent
fcb53fbb58
commit
6d87c58fb4
@ -375,7 +375,7 @@ struct server {
|
|||||||
/* Storage structure to load server-state lines from a flat file into
|
/* Storage structure to load server-state lines from a flat file into
|
||||||
* an ebtree, for faster processing
|
* an ebtree, for faster processing
|
||||||
*/
|
*/
|
||||||
struct state_line {
|
struct server_state_line {
|
||||||
char *line;
|
char *line;
|
||||||
struct ebmb_node node;
|
struct ebmb_node node;
|
||||||
/* WARNING don't put anything after node, it's used by the key */
|
/* WARNING don't put anything after node, it's used by the key */
|
||||||
|
24
src/server.c
24
src/server.c
@ -3220,7 +3220,7 @@ void apply_server_state(void)
|
|||||||
{
|
{
|
||||||
struct proxy *curproxy;
|
struct proxy *curproxy;
|
||||||
struct server *srv;
|
struct server *srv;
|
||||||
struct state_line *st;
|
struct server_state_line *st_line;
|
||||||
struct ebmb_node *node, *next_node;
|
struct ebmb_node *node, *next_node;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *params[SRV_STATE_FILE_MAX_FIELDS] = {0};
|
char *params[SRV_STATE_FILE_MAX_FIELDS] = {0};
|
||||||
@ -3269,21 +3269,21 @@ void apply_server_state(void)
|
|||||||
chunk_printf(&trash, "%s %s", params[1], params[3]);
|
chunk_printf(&trash, "%s %s", params[1], params[3]);
|
||||||
|
|
||||||
/* store line in tree */
|
/* store line in tree */
|
||||||
st = calloc(1, sizeof(*st) + trash.data + 1);
|
st_line = calloc(1, sizeof(*st_line) + trash.data + 1);
|
||||||
if (st == NULL) {
|
if (st_line == NULL) {
|
||||||
goto nextline;
|
goto nextline;
|
||||||
}
|
}
|
||||||
memcpy(st->node.key, trash.area, trash.data + 1);
|
memcpy(st_line->node.key, trash.area, trash.data + 1);
|
||||||
if (ebst_insert(&state_file, &st->node) != &st->node) {
|
if (ebst_insert(&state_file, &st_line->node) != &st_line->node) {
|
||||||
/* this is a duplicate key, probably a hand-crafted file,
|
/* this is a duplicate key, probably a hand-crafted file,
|
||||||
* drop it!
|
* drop it!
|
||||||
*/
|
*/
|
||||||
free(st);
|
free(st_line);
|
||||||
goto nextline;
|
goto nextline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save line */
|
/* save line */
|
||||||
st->line = line;
|
st_line->line = line;
|
||||||
line = NULL;
|
line = NULL;
|
||||||
nextline:
|
nextline:
|
||||||
/* free up memory in case of error during the processing of the line */
|
/* free up memory in case of error during the processing of the line */
|
||||||
@ -3321,8 +3321,8 @@ void apply_server_state(void)
|
|||||||
node = ebst_lookup(&state_file, trash.area);
|
node = ebst_lookup(&state_file, trash.area);
|
||||||
if (!node)
|
if (!node)
|
||||||
continue; /* next server */
|
continue; /* next server */
|
||||||
st = ebmb_entry(node, struct state_line, node);
|
st_line = ebmb_entry(node, typeof(*st_line), node);
|
||||||
strcpy(mybuf, st->line); /* st->line is always small enough */
|
strcpy(mybuf, st_line->line); /* st_line->line is always small enough */
|
||||||
|
|
||||||
ret = srv_state_parse_line(mybuf, global_vsn, params);
|
ret = srv_state_parse_line(mybuf, global_vsn, params);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
@ -3415,11 +3415,11 @@ void apply_server_state(void)
|
|||||||
|
|
||||||
node = ebmb_first(&state_file);
|
node = ebmb_first(&state_file);
|
||||||
while (node) {
|
while (node) {
|
||||||
st = ebmb_entry(node, struct state_line, node);
|
st_line = ebmb_entry(node, typeof(*st_line), node);
|
||||||
next_node = ebmb_next(node);
|
next_node = ebmb_next(node);
|
||||||
ebmb_delete(node);
|
ebmb_delete(node);
|
||||||
free(st->line);
|
free(st_line->line);
|
||||||
free(st);
|
free(st_line);
|
||||||
node = next_node;
|
node = next_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user