mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 11:45:07 -05:00
Multiply clientlog node table size when reallocating
This commit is contained in:
13
clientlog.c
13
clientlog.c
@@ -85,8 +85,6 @@ static int n_nodes = 0;
|
|||||||
/* Number of entries for which the table has been sized. */
|
/* Number of entries for which the table has been sized. */
|
||||||
static int max_nodes = 0;
|
static int max_nodes = 0;
|
||||||
|
|
||||||
#define NODE_TABLE_INCREMENT 4
|
|
||||||
|
|
||||||
/* Flag indicating whether facility is turned on or not */
|
/* Flag indicating whether facility is turned on or not */
|
||||||
static int active = 0;
|
static int active = 0;
|
||||||
|
|
||||||
@@ -192,13 +190,12 @@ create_node(Subnet *parent_subnet, int the_entry)
|
|||||||
|
|
||||||
if (n_nodes == max_nodes) {
|
if (n_nodes == max_nodes) {
|
||||||
if (nodes) {
|
if (nodes) {
|
||||||
max_nodes += NODE_TABLE_INCREMENT;
|
assert(max_nodes > 0);
|
||||||
|
max_nodes *= 2;
|
||||||
nodes = ReallocArray(Node *, max_nodes, nodes);
|
nodes = ReallocArray(Node *, max_nodes, nodes);
|
||||||
} else {
|
} else {
|
||||||
if (max_nodes != 0) {
|
assert(max_nodes == 0);
|
||||||
CROAK("max_nodes should be 0");
|
max_nodes = 16;
|
||||||
}
|
|
||||||
max_nodes = NODE_TABLE_INCREMENT;
|
|
||||||
nodes = MallocArray(Node *, max_nodes);
|
nodes = MallocArray(Node *, max_nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,7 +340,7 @@ CLG_LogCommandAccess(IPAddr *client, CLG_Command_Type type, time_t now)
|
|||||||
++node->cmd_hits_bad;
|
++node->cmd_hits_bad;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CROAK("Impossible");
|
assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user