From 175c5a776016b2d340e8398fbfdebc580021061c Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Tue, 14 Mar 2000 22:50:34 +0000 Subject: [PATCH] added code in listen_for_queries() to refersh master list of service from database every 15 minutes --- src/spong-server.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/spong-server.pl b/src/spong-server.pl index 40cce7d..9f0816a 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -144,7 +144,7 @@ sub usage { --restart Signal a running spong-server to restart. --kill - Signal a running spong-server to terminated. + Signal a running spong-server to terminate. config_file Use the named file as configuration file. ); @@ -362,9 +362,18 @@ sub listen_for_queries { ); if (! defined $sock ) { die "socket: $!"; } + my( $next_update ) = time() + (15 * 60); + &debug( "query server socket setup, listening for connections" ); while( 1 ) { + # Update the service list from the database every 15 minutes + if ( $time >= $next_update ) { + foreach $host ( Spong::HostList->new( "all" )->hosts() ) { + foreach $service ( $host->service_names() ) { + $main::SERVICES{$service}=1;}} + $next_update =+ 15 * 60; + } next unless ( $client = $sock->accept() ); my $paddr = $client->peerhost(); @@ -977,7 +986,7 @@ sub init_logging { Spong::Log::set_error_context( syslog => $syslog, ident => 'spong-server', - logopt => 'pid cons', + logopt => 'pid,cons', priority => 'ERR', filename => $filename, ); -- 2.30.2