From ea9626b60092f2d2c79431718c3ca8bc383429a6 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 17 Nov 2019 16:58:02 +0100 Subject: Networking setup --- src/ufo-roof-config.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ufo-roof-config.c') diff --git a/src/ufo-roof-config.c b/src/ufo-roof-config.c index 11f8bd4..812d4a2 100644 --- a/src/ufo-roof-config.c +++ b/src/ufo-roof-config.c @@ -83,6 +83,7 @@ UfoRoofConfig *ufo_roof_config_new(const char *config, GError **error) { cfg->max_packets = 100; cfg->dataset_size = 0; cfg->buffer_size = 2; + cfg->drop_buffers = 0; cfg->path = NULL; // Read configuration @@ -101,6 +102,7 @@ UfoRoofConfig *ufo_roof_config_new(const char *config, GError **error) { roof_config_node_get(hardware, root, object, "hardware"); roof_config_node_get(network, root, object, "network"); roof_config_node_get(simulation, root, object, "simulation"); + roof_config_node_get(performance, root, object, "performance"); } if (hardware) { @@ -123,6 +125,7 @@ UfoRoofConfig *ufo_roof_config_new(const char *config, GError **error) { if (performance) { roof_config_node_get(cfg->max_packets, performance, int, "packets_at_once"); roof_config_node_get(cfg->buffer_size, performance, int, "buffer_size"); + roof_config_node_get(cfg->drop_buffers, performance, int, "drop_buffers"); } if (simulation) { @@ -167,6 +170,11 @@ UfoRoofConfig *ufo_roof_config_new(const char *config, GError **error) { if (!cfg->dataset_size) cfg->dataset_size = cfg->payload_size; + if (cfg->buffer_size < 4) { + cfg->drop_buffers = 0; + } else if (cfg->drop_buffers >= cfg->buffer_size) { + cfg->drop_buffers = cfg->buffer_size / 2; + } return cfg; } -- cgit v1.2.3