From a9ac222ee08158adacf4892c9b237305b1c6049e Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 20 Mar 2022 11:01:19 +0100 Subject: tools: Support --quiet option for oping server The oping server will not print receiving packets when the --quiet (-Q) flag is passed, like the client. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/tools/oping/oping.c | 5 ++++- src/tools/oping/oping_server.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c index 093f3e84..62eb94d5 100644 --- a/src/tools/oping/oping.c +++ b/src/tools/oping/oping.c @@ -96,6 +96,8 @@ struct s { fqueue_t * fq; pthread_mutex_t lock; + bool quiet; + pthread_t cleaner_pt; pthread_t accept_pt; pthread_t server_pt; @@ -170,6 +172,7 @@ int main(int argc, client.timestamp = false; client.qs = qos_raw; client.quiet = false; + server.quiet = false; while (argc > 0) { if (strcmp(*argv, "-i") == 0 || @@ -207,7 +210,7 @@ int main(int argc, } else if (strcmp(*argv, "-Q") == 0 || strcmp(*argv, "--quiet") == 0) { client.quiet = true; - + server.quiet = true; } else { goto fail; } diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index ec9e85ab..b2eb308e 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -105,7 +105,8 @@ void * server_thread(void *o) continue; } - printf("Received %d bytes on fd %d.\n", msg_len, fd); + if (!server.quiet) + printf("Received %d bytes on fd %d.\n", msg_len, fd); clock_gettime(CLOCK_REALTIME, &now); -- cgit v1.2.3