From e82890a2aad918d5a8cd259dbc110d8a71732265 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 1 Aug 2012 03:00:00 +0200 Subject: [PATCH] tcpproxy: reduce verbosity --- tcpproxy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tcpproxy.c b/tcpproxy.c index fb2863b..b2d1651 100644 --- a/tcpproxy.c +++ b/tcpproxy.c @@ -11,6 +11,8 @@ enum STACK = 32768 }; +static int verbose; + char *server; int port; void proxytask(void*); @@ -51,7 +53,8 @@ taskmain(int argc, char **argv) } fdnoblock(fd); while((cfd = netaccept(fd, remote, &rport)) >= 0){ - fprintf(stderr, "connection from %s:%d\n", remote, rport); + if(verbose) + fprintf(stderr, "connection from %s:%d\n", remote, rport); taskcreate(proxytask, (void*)(uintptr_t)cfd, STACK); } } @@ -66,8 +69,9 @@ proxytask(void *v) close(fd); return; } - - fprintf(stderr, "connected to %s:%d\n", server, port); + + if(verbose) + fprintf(stderr, "connected to %s:%d\n", server, port); taskcreate(rwtask, mkfd2(fd, remotefd), STACK); taskcreate(rwtask, mkfd2(remotefd, fd), STACK);