From a0ba44546f73039bc9affbe57741e2e2b6d7e3a3 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Sat, 17 Jul 2021 19:53:54 +0200 Subject: [PATCH] Make buffer size configurable at compile time and set it to 8192 --- NEWS | 1 + meson.build | 2 ++ meson_options.txt | 4 ++++ src/buffer.h | 4 +++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0b30f754..262dcd67 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ libmpdclient 2.20 (not yet released) - albumart * support tags "ComposerSort", "Ensemble", "Movement", "MovementNumber", "Location" +* configurable buffer size, increase default from 4096 to 8192 libmpdclient 2.19 (2020/07/03) * fix off-by-one bug in MPD_HOST parser diff --git a/meson.build b/meson.build index 2390f6d1..f54e2717 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,8 @@ conf.set('DEFAULT_PORT', get_option('default_port')) conf.set('HAVE_STRNDUP', cc.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include ')) +conf.set('BUFFER_SIZE', get_option('buffer_size')) + platform_deps = [] if host_machine.system() == 'haiku' platform_deps = [cc.find_library('network')] diff --git a/meson_options.txt b/meson_options.txt index f2f2ec5a..5e3ea00a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -21,3 +21,7 @@ option('documentation', type: 'boolean', option('test', type: 'boolean', value: false, description: 'Enable unit tests') + +option('buffer_size', type: 'string', + value: '8192', + description: 'response buffer size') diff --git a/src/buffer.h b/src/buffer.h index cd4a6a5f..f5f7974b 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -29,6 +29,8 @@ #ifndef MPD_BUFFER_H #define MPD_BUFFER_H +#include "config.h" + #include #include #include @@ -45,7 +47,7 @@ struct mpd_buffer { unsigned read; /** the actual buffer */ - unsigned char data[4096]; + unsigned char data[BUFFER_SIZE]; }; /**