sources: allow setting minsamples and maxsamples for each source

The minsamples and maxsamples directives now set the default value,
which can be overriden for individual sources in the server/peer/pool
and refclock directives.
This commit is contained in:
Miroslav Lichvar
2014-12-01 18:35:35 +01:00
parent 42dd5caa1b
commit 6688f40325
13 changed files with 108 additions and 22 deletions

View File

@@ -207,14 +207,19 @@ void SRC_Finalise(void)
/* Function to create a new instance. This would be called by one of
the individual source-type instance creation routines. */
SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, SRC_SelectOption sel_option, IPAddr *addr)
SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, SRC_SelectOption sel_option, IPAddr *addr, int min_samples, int max_samples)
{
SRC_Instance result;
assert(initialised);
if (min_samples == SRC_DEFAULT_MINSAMPLES)
min_samples = CNF_GetMinSamples();
if (max_samples == SRC_DEFAULT_MAXSAMPLES)
max_samples = CNF_GetMaxSamples();
result = MallocNew(struct SRC_Instance_Record);
result->stats = SST_CreateInstance(ref_id, addr);
result->stats = SST_CreateInstance(ref_id, addr, min_samples, max_samples);
if (n_sources == max_n_sources) {
/* Reallocate memory */