diff options
Diffstat (limited to 'src/ufo-roof-buffer.c')
-rw-r--r-- | src/ufo-roof-buffer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ufo-roof-buffer.c b/src/ufo-roof-buffer.c index f83885e..179d153 100644 --- a/src/ufo-roof-buffer.c +++ b/src/ufo-roof-buffer.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <stdint.h> +#include <time.h> #include "glib.h" @@ -8,10 +9,11 @@ // This is currently not thread safe. With dual-filter architecture this will be called sequentially. -UfoRoofBuffer *ufo_roof_buffer_new(UfoRoofConfig *cfg, GError **error) { +UfoRoofBuffer *ufo_roof_buffer_new(UfoRoofConfig *cfg, guint max_datasets, GError **error) { UfoRoofBuffer *buffer = (UfoRoofBuffer*)calloc(1, sizeof(UfoRoofBuffer)); if (!buffer) roof_new_error(error, "Can't allocate UfoRoofBuffer"); + buffer->max_datasets = max_datasets; buffer->ring_size = cfg->buffer_size; buffer->drop_buffers = cfg->drop_buffers; buffer->fragment_size = cfg->payload_size; @@ -65,6 +67,9 @@ gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, gu return FALSE; // roof_network_error_with_retval(error, FALSE, "Late arrived packet for dataset %i, currently processing %i", dataset_id, buffer->current_id); + if ((buffer->max_datasets)&&(dataset_id >= buffer->max_datasets)) + return FALSE; + // We are not fast enough, new packets are arrvining to fast if (dataset_id >= (buffer->current_id + buffer->ring_size)) { // FIXME: Broken packets sanity checks? Allocate additional buffers on demand? |