From bb8babc044e9a13a51016be397b51211c4fa1fab Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Thu, 11 Apr 2019 15:35:38 +0300 Subject: daemon: honour the verbose flag for diagnostics. Signed-off-by: Gediminas Jakutis --- src/daemon/net.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/daemon/net.c b/src/daemon/net.c index 27375e3..3b4f022 100644 --- a/src/daemon/net.c +++ b/src/daemon/net.c @@ -32,6 +32,7 @@ #include #include #include +#include "settings.h" #include "net.h" struct netstate { @@ -175,7 +176,7 @@ static void *dolisten(void * state) if (st->data[0] == 'I' && !(strcmp(st->data, servermagic))) { sendto(st->sock, clientmagic, sizeof(clientmagic), MSG_DONTWAIT, (struct sockaddr *) &clientaddr, sizeof(clientaddr)); - //fprintf(stderr, "Sending DATA, timestap: %li \n", st->lastreply.tv_sec); + setting_verbose() ? fprintf(stderr, "Sending DATA, timestap: %li \n", st->lastreply.tv_sec) : 0; } } @@ -191,10 +192,10 @@ static void *dolisten(void * state) oldstatus = st->status; if(st->status == DEAD) { /* this timestamp is arbitraty */ - fprintf(stderr, "Connection with the client has been lost. Last reply since: %li \n", st->lastreply.tv_sec); + setting_verbose() ? fprintf(stderr, "Connection with the client has been lost. Last reply since: %li \n", st->lastreply.tv_sec) : 0; } else { ipstring = inet_ntoa(clientaddr.sin_addr); - fprintf(stderr, "Successful incoming connection from %s\n", ipstring); + setting_verbose() ? fprintf(stderr, "Successful incoming connection from %s\n", ipstring) : 0; } } pthread_mutex_unlock(&st->datamutex); -- cgit v1.2.3