summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-03-20 11:01:19 +0100
committerSander Vrijders <sander@ouroboros.rocks>2022-03-30 14:56:54 +0200
commita9ac222ee08158adacf4892c9b237305b1c6049e (patch)
tree49d0f352033c45536a5f48b7e39d3b9b9054a087 /src/tools
parent3b179d0ec9b85133ef412bae26c76eb74b75ea67 (diff)
downloadouroboros-a9ac222ee08158adacf4892c9b237305b1c6049e.tar.gz
ouroboros-a9ac222ee08158adacf4892c9b237305b1c6049e.zip
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 <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/oping/oping.c5
-rw-r--r--src/tools/oping/oping_server.c3
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);