From 7a98128e053ccd59203757982f7332ed5e4568ea Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 12 Oct 2017 18:12:05 +0200 Subject: lib: Re-enable multi-block support Multi-block support was forgotten during the update of the build system. This enables it again and fixes some bugs when it is disabled and larger SDUs are sent. --- src/lib/CMakeLists.txt | 2 ++ src/lib/config.h.in | 1 + src/lib/dev.c | 2 ++ src/tools/cbr/cbr_client.c | 4 ++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 6ab5ebc8..00670f65 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -165,6 +165,8 @@ set(SHM_RDRB_NAME "/${SHM_PREFIX}.rdrb" CACHE INTERNAL "Name for the main POSIX shared memory buffer") set(SHM_RDRB_BLOCK_SIZE "sysconf(_SC_PAGESIZE)" CACHE STRING "SDU buffer block size, multiple of pagesize for performance") +set(SHM_RDRB_MULTI_BLOCK true CACHE BOOL + "SDU buffer multiblock SDU support") set(SHM_RBUFF_LOCKLESS 0 CACHE BOOL "Enable shared memory lockless rbuff support") diff --git a/src/lib/config.h.in b/src/lib/config.h.in index a85ce7b4..40ac945d 100644 --- a/src/lib/config.h.in +++ b/src/lib/config.h.in @@ -27,6 +27,7 @@ #define SYS_MAX_FLOWS @SYS_MAX_FLOWS@ #cmakedefine SHM_RBUFF_LOCKLESS +#cmakedefine SHM_RDRB_MULTI_BLOCK #define SHM_RBUFF_PREFIX "@SHM_RBUFF_PREFIX@" #define SHM_LOCKFILE_NAME "@SHM_LOCKFILE_NAME@" diff --git a/src/lib/dev.c b/src/lib/dev.c index 9cb6f2ed..e6e5b4d4 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -1095,6 +1095,8 @@ ssize_t flow_write(int fd, DU_BUFF_TAILSPACE, buf, count); + if (idx < 0) + return idx; pthread_rwlock_rdlock(&ai.lock); } diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c index decf6f96..79425ff2 100644 --- a/src/tools/cbr/cbr_client.c +++ b/src/tools/cbr/cbr_client.c @@ -102,7 +102,7 @@ int client_main(char * server, ts_add(&end, &intv, &end); memcpy(buf, &seqnr, sizeof(seqnr)); - if (flow_write(fd, buf, size) == -1) { + if (flow_write(fd, buf, size) < 0) { stop = true; continue; } @@ -120,7 +120,7 @@ int client_main(char * server, } else { /* flood */ while (!stop) { clock_gettime(CLOCK_REALTIME, &end); - if (flow_write(fd, buf, (size_t) size) == -1) { + if (flow_write(fd, buf, (size_t) size) < 0) { stop = true; continue; } -- cgit v1.2.3