summaryrefslogtreecommitdiffstats
path: root/src/ufo-roof-config.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 16:58:02 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 16:58:02 +0100
commitea9626b60092f2d2c79431718c3ca8bc383429a6 (patch)
treef76a6dcf118fc3977eda1cbcf368018715ebe01c /src/ufo-roof-config.c
parent23f22348c5281fff685c1fa89255e7e1e76266a4 (diff)
downloadufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.tar.gz
ufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.tar.bz2
ufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.tar.xz
ufo-roof-temp-ea9626b60092f2d2c79431718c3ca8bc383429a6.zip
Networking setup
Diffstat (limited to 'src/ufo-roof-config.c')
-rw-r--r--src/ufo-roof-config.c8
1 files changed, 8 insertions, 0 deletions
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;
}