mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-11 09:37:20 +02:00
MINOR: peers: Add additional information to stick-table definition messages.
With this patch additional information are added to stick-table definition messages so that to make external application capable of learning peer stick-table configurations. First stick-table entries duration is added followed by the frequency counters type IDs and values. May be backported to 1.7 and 1.6.
This commit is contained in:
parent
570f799877
commit
37a72546f6
18
src/peers.c
18
src/peers.c
@ -383,7 +383,8 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
unsigned short datalen;
|
unsigned short datalen;
|
||||||
char *cursor, *datamsg;
|
struct chunk *chunk;
|
||||||
|
char *cursor, *datamsg, *chunkp, *chunkq;
|
||||||
uint64_t data = 0;
|
uint64_t data = 0;
|
||||||
unsigned int data_type;
|
unsigned int data_type;
|
||||||
|
|
||||||
@ -407,6 +408,8 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
|
|||||||
/* encode table key size */
|
/* encode table key size */
|
||||||
intencode(st->table->key_size, &cursor);
|
intencode(st->table->key_size, &cursor);
|
||||||
|
|
||||||
|
chunk = get_trash_chunk();
|
||||||
|
chunkp = chunkq = chunk->str;
|
||||||
/* encode available known data types in table */
|
/* encode available known data types in table */
|
||||||
for (data_type = 0 ; data_type < STKTABLE_DATA_TYPES ; data_type++) {
|
for (data_type = 0 ; data_type < STKTABLE_DATA_TYPES ; data_type++) {
|
||||||
if (st->table->data_ofs[data_type]) {
|
if (st->table->data_ofs[data_type]) {
|
||||||
@ -414,14 +417,27 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
|
|||||||
case STD_T_SINT:
|
case STD_T_SINT:
|
||||||
case STD_T_UINT:
|
case STD_T_UINT:
|
||||||
case STD_T_ULL:
|
case STD_T_ULL:
|
||||||
|
data |= 1 << data_type;
|
||||||
|
break;
|
||||||
case STD_T_FRQP:
|
case STD_T_FRQP:
|
||||||
data |= 1 << data_type;
|
data |= 1 << data_type;
|
||||||
|
intencode(data_type, &chunkq);
|
||||||
|
intencode(st->table->data_arg[data_type].u, &chunkq);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intencode(data, &cursor);
|
intencode(data, &cursor);
|
||||||
|
|
||||||
|
/* Encode stick-table entries duration. */
|
||||||
|
intencode(st->table->expire, &cursor);
|
||||||
|
|
||||||
|
if (chunkq > chunkp) {
|
||||||
|
chunk->len = chunkq - chunkp;
|
||||||
|
memcpy(cursor, chunk->str, chunk->len);
|
||||||
|
cursor += chunk->len;
|
||||||
|
}
|
||||||
|
|
||||||
/* Compute datalen */
|
/* Compute datalen */
|
||||||
datalen = (cursor - datamsg);
|
datalen = (cursor - datamsg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user