From 889cb601fab517d2045f7acb7c14cf004059232d Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 14 Mar 2020 17:15:51 +0100 Subject: [PATCH] Make the send/receive buffer size configurable in the test program. --- test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test.c b/test.c index 68b42b2..87a0411 100644 --- a/test.c +++ b/test.c @@ -32,6 +32,7 @@ long total_out; long total_in; FILE *reference; long mtu = 0; +long bufsize; char *reorder_data; size_t reorder_len; @@ -94,6 +95,12 @@ void do_accept(struct utcp_connection *nc, uint16_t port) { (void)port; utcp_accept(nc, do_recv, NULL); c = nc; + + if(bufsize) { + utcp_set_sndbuf(c, bufsize); + utcp_set_rcvbuf(c, bufsize); + } + utcp_set_accept_cb(c->utcp, NULL, NULL); } @@ -205,6 +212,10 @@ int main(int argc, char *argv[]) { mtu = atoi(getenv("MTU")); } + if(getenv("BUFSIZE")) { + bufsize = atoi(getenv("BUFSIZE")); + } + char *reference_filename = getenv("REFERENCE"); if(reference_filename) { @@ -267,6 +278,11 @@ int main(int argc, char *argv[]) { if(!server) { set_mtu(u, s); c = utcp_connect_ex(u, 1, do_recv, NULL, flags); + + if(bufsize) { + utcp_set_sndbuf(c, bufsize); + utcp_set_rcvbuf(c, bufsize); + } } struct pollfd fds[2] = { -- 2.39.5