summaryrefslogtreecommitdiffstats
path: root/src/ufo-roof-buffer.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 21:09:05 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 21:09:05 +0100
commitad39481f238218ed3f3ce0f46c975a7ab178b5b5 (patch)
tree7d95a9c5fede3bec3880c53198de3fe752a75f75 /src/ufo-roof-buffer.c
parentea9626b60092f2d2c79431718c3ca8bc383429a6 (diff)
downloadufo-roof-ad39481f238218ed3f3ce0f46c975a7ab178b5b5.tar.gz
ufo-roof-ad39481f238218ed3f3ce0f46c975a7ab178b5b5.tar.bz2
ufo-roof-ad39481f238218ed3f3ce0f46c975a7ab178b5b5.tar.xz
ufo-roof-ad39481f238218ed3f3ce0f46c975a7ab178b5b5.zip
Few timeouts & exit conditions
Diffstat (limited to 'src/ufo-roof-buffer.c')
-rw-r--r--src/ufo-roof-buffer.c7
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?