ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/ihost.pl
(Generate patch)

Comparing projects/cms/source/host/ihost-perl/ihost.pl (file contents):
Revision 1.32 by pjm2, Fri Mar 16 18:25:59 2001 UTC vs.
Revision 1.35 by tdb, Wed Nov 14 14:17:12 2001 UTC

# Line 45 | Line 45 | $filter_manager_addr = $ARGV[0];
45   $filter_manager_port = $ARGV[1];
46  
47   $seq_no = 1;
48 < $retry_wait = 6;
48 > $retry_wait = 60;
49  
50   # write our PID to a file
51   $pidfile = "/var/tmp/ihost.pid";
# Line 75 | Line 75 | while (1) {
75      else {
76          $delay = $next_tcp;
77      }
78 <    `sleep $delay`;
78 >    sleep $delay;
79   }
80  
81   # we'll probably never get here...
# Line 90 | Line 90 | exit(0);
90   #-----------------------------------------------------------------------
91   sub wait_then_retry() {
92      print "Will retry configuration with filter manager in $retry_wait seconds.\n";
93 <    `sleep $retry_wait`;
93 >    sleep $retry_wait;
94   }
95  
96  
# Line 283 | Line 283 | sub send_udp_packet() {
283      }
284      $disk_info .= "</disk>";
285  
286 <    my($ip) = inet_ntoa(scalar(gethostbyname(hostname())) || 'localhost');
286 >    my($ip);
287 >    $ip = inet_ntoa(scalar(gethostbyname(hostname())) || 'localhost') or $ip = 'localhost';
288  
289      # Build the XML packet this way, as we can clearly
290      # see the structure and contents... I like this ;-)
# Line 360 | Line 361 | EOF
361   # send_tcp_heartbeat
362   # Establishes a TCP connection to an i-scream filter.
363   # The heartbeat is used as a guaranteed "I'm alive" delivery mechanism.
364 + # If we need to reconfigure, then we complete the heartbeat before
365 + # doing so.
366   #-----------------------------------------------------------------------
367   sub send_tcp_heartbeat() {
368  
369 +    my ($doReconfigure) = 0;
370 +
371      my($sock) = new IO::Socket::INET(
372                                       PeerAddr => $filter_addr,
373                                       PeerPort => $tcp_port,
# Line 409 | Line 414 | sub send_tcp_heartbeat() {
414      if ($response eq "ERROR\n") {
415          close($sock);
416          print "Server configuration changed.  Reconfiguring with filter manager.\n";
417 <        &tcp_configure();
413 <        return;
417 >        $doReconfigure = 1;
418      }
419      if (!$response eq "OK\n") {
420          close($sock);
# Line 430 | Line 434 | sub send_tcp_heartbeat() {
434      
435      close($sock);
436      print "^";
437 +    
438 +    &tcp_configure() if $doReconfigure;
439      
440      return;
441   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines