From f57748cace780875adb92a1bb61e0b12550e052d Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 7 May 2018 17:43:18 +0200 Subject: tools: Disable partial reads in oping The oping tool was using a 1500 byte buffer, but didn't account for partial reads when sending 1500 byte packets. This disables the partial reads. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/tools/oping/oping_client.c | 2 ++ src/tools/oping/oping_server.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/tools/oping') diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index 6f874dd9..d026a683 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -215,6 +215,8 @@ static int client_main(void) return -1; } + fccntl(fd, FLOWSFLAGS, FLOWFRDWR | FLOWFRNOPART); + clock_gettime(CLOCK_REALTIME, &tic); pthread_create(&client.reader_pt, NULL, reader, &fd); diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index 391da197..10926763 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -118,9 +118,9 @@ void * server_thread(void *o) void * accept_thread(void * o) { - int fd; + int fd; struct timespec now; - qosspec_t qs; + qosspec_t qs; (void) o; @@ -142,7 +142,8 @@ void * accept_thread(void * o) server.times[fd] = now; pthread_mutex_unlock(&server.lock); - fccntl(fd, FLOWSFLAGS, FLOWFRNOBLOCK | FLOWFRDWR); + fccntl(fd, FLOWSFLAGS, + FLOWFRNOBLOCK | FLOWFRDWR | FLOWFRNOPART); } return (void *) 0; -- cgit v1.2.3