]> git.etc.gen.nz Git - spong.git/commitdiff
added code in listen_for_queries() to refersh master list of service from database...
authorStephen L Johnson <sjohnson@monsters.org>
Tue, 14 Mar 2000 22:50:34 +0000 (22:50 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Tue, 14 Mar 2000 22:50:34 +0000 (22:50 +0000)
src/spong-server.pl

index 40cce7d158f30278ee147578ec26cb750b0fbc56..9f0816a769c2805522cabb0a298a84940761d9b1 100755 (executable)
@@ -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,
                                  );