tcpproxy: reduce verbosity

This commit is contained in:
David du Colombier 2012-08-01 03:00:00 +02:00
parent eed781b1a9
commit e82890a2aa

View File

@ -11,6 +11,8 @@ enum
STACK = 32768 STACK = 32768
}; };
static int verbose;
char *server; char *server;
int port; int port;
void proxytask(void*); void proxytask(void*);
@ -51,6 +53,7 @@ taskmain(int argc, char **argv)
} }
fdnoblock(fd); fdnoblock(fd);
while((cfd = netaccept(fd, remote, &rport)) >= 0){ while((cfd = netaccept(fd, remote, &rport)) >= 0){
if(verbose)
fprintf(stderr, "connection from %s:%d\n", remote, rport); fprintf(stderr, "connection from %s:%d\n", remote, rport);
taskcreate(proxytask, (void*)(uintptr_t)cfd, STACK); taskcreate(proxytask, (void*)(uintptr_t)cfd, STACK);
} }
@ -67,6 +70,7 @@ proxytask(void *v)
return; return;
} }
if(verbose)
fprintf(stderr, "connected to %s:%d\n", server, port); fprintf(stderr, "connected to %s:%d\n", server, port);
taskcreate(rwtask, mkfd2(fd, remotefd), STACK); taskcreate(rwtask, mkfd2(fd, remotefd), STACK);