Do not print information message when no connection is cleaned at shutdown

This commit is contained in:
William Robinet 2020-12-09 16:01:54 +01:00
parent cbff44d4a4
commit 28b4915099

View file

@ -129,10 +129,15 @@ int print_version()
pcap_t *p;
void sig_handler(int sig)
{
int freed_conn = 0;
fflush(stdout);
if (logger)
logger->vtbl->deinit();
printf("Cleaning %d remaining connection(s) from connection pool\n", destroy_all_conn());
freed_conn = destroy_all_conn();
if(freed_conn)
printf("Cleaned %d remaining connection(s) from connection pool\n", freed_conn);
if(p)
pcap_close(p);
exit(0);
@ -299,6 +304,7 @@ int main(argc,argv)
int c;
module_def *m=0;
int no_promiscuous=0;
int freed_conn=0;
char errbuf[PCAP_ERRBUF_SIZE];
@ -477,7 +483,9 @@ int main(argc,argv)
if(NET_print_flags & NET_PRINT_TYPESET)
printf("\n.ps\n.fi\n");
printf("Cleaning %d remaining connection(s) from connection pool\n", destroy_all_conn());
freed_conn = destroy_all_conn();
if(freed_conn)
printf("Cleaned %d remaining connection(s) from connection pool\n", freed_conn);
pcap_close(p);