From: Florian Forster Date: Tue, 2 May 2017 09:08:37 +0000 (+0200) Subject: libcollectdclient: Add LCC_NETWORK_BUFFER_SIZE. X-Git-Tag: collectd-5.8.0~102^2~12 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=98d25510a339e789c27ee234558476b04185bd51;p=collectd.git libcollectdclient: Add LCC_NETWORK_BUFFER_SIZE. --- diff --git a/src/libcollectdclient/collectd/server.h b/src/libcollectdclient/collectd/server.h index d1902173..38bc68f7 100644 --- a/src/libcollectdclient/collectd/server.h +++ b/src/libcollectdclient/collectd/server.h @@ -34,6 +34,10 @@ #include +#ifndef LCC_NETWORK_BUFFER_SIZE +#define LCC_NETWORK_BUFFER_SIZE 1452 +#endif + LCC_BEGIN_DECLS /* lcc_network_parser_t is a callback that parses received network packets. It @@ -62,7 +66,8 @@ typedef struct { /* parse_options contains options for parser and is passed on verbatimely. */ lcc_network_parse_options_t parse_options; - /* buffer_size determines the maximum packet size to accept. */ + /* buffer_size determines the maximum packet size to accept. Defaults to + * LCC_NETWORK_BUFFER_SIZE if set to zero. */ uint16_t buffer_size; /* interface is the name of the interface to use when subscribing to a diff --git a/src/libcollectdclient/server.c b/src/libcollectdclient/server.c index 1c4a1013..50f6be1d 100644 --- a/src/libcollectdclient/server.c +++ b/src/libcollectdclient/server.c @@ -186,8 +186,7 @@ int lcc_listen_and_write(lcc_listener_t srv) { } if (srv.buffer_size == 0) - /* TODO(octo): this should be a define. */ - srv.buffer_size = 1452; + srv.buffer_size = LCC_NETWORK_BUFFER_SIZE; if (srv.parser == NULL) srv.parser = lcc_network_parse;