rpc: create the statistics table only once

Use the new stat_tap_find_table function during init to check if our
statistics table already exists.
This commit is contained in:
Martin Kaiser 2021-01-29 18:44:20 +01:00 committed by AndersBroman
parent f21f1c292a
commit b49b95af65
1 changed files with 7 additions and 4 deletions

View File

@ -3926,12 +3926,15 @@ static stat_tap_table_item rpc_prog_stat_fields[] = {
static void rpc_prog_stat_init(stat_tap_table_ui* new_stat)
{
const char *table_name = "ONC-RPC Program Statistics";
int num_fields = sizeof(rpc_prog_stat_fields)/sizeof(stat_tap_table_item);
stat_tap_table* table;
table = stat_tap_init_table("ONC-RPC Program Statistics", num_fields, 0, NULL);
stat_tap_add_table(new_stat, table);
stat_tap_table *table;
table = stat_tap_find_table(new_stat, table_name);
if (!table) {
table = stat_tap_init_table(table_name, num_fields, 0, NULL);
stat_tap_add_table(new_stat, table);
}
}
static tap_packet_status