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.22 by pjm2, Thu Mar 1 10:49:27 2001 UTC vs.
Revision 1.24 by pjm2, Tue Mar 6 08:38:42 2001 UTC

# Line 151 | Line 151 | sub tcp_configure() {
151      
152      print $sock "FILTER\n";
153      $response = <$sock>;
154 +    unless (defined($response)) {
155 +        print "Failed: Could not get a filter address from the filter manager.\n";
156 +        exit(1);
157 +    }
158      chop $response;
159      $response =~ /(.*);(.*);(.*)/;
160      ($filter_addr, $udp_port, $tcp_port) = ($1, $2, $3);
161 +    unless (defined($filter_addr) && defined($udp_port) && defined($tcp_port)) {
162 +        print "Failed: Filter address response from server did not make sense: $response\n";
163 +        exit(1);
164 +    }
165      
166      print "Got filter data ($filter_addr, $udp_port, $tcp_port)\n";
167  
# Line 304 | Line 312 | sub send_tcp_heartbeat() {
312  
313      print $sock "HEARTBEAT\n";
314      $response = <$sock>;
315 <    chop $response or return;
315 >    return if (!defined $response);
316 >    chop $response;
317      if (!$response eq "OK") {
318          close($sock);
319          print "Server gave wrong response to HEARTBEAT: $response\n";
# Line 313 | Line 322 | sub send_tcp_heartbeat() {
322      
323      print $sock "CONFIG\n";
324      $response = <$sock>;
325 <    chop $response or return;
325 >    return if (!defined $response);
326 >    chop $response;
327      if (!$response eq "OK") {
328          close($sock);
329          print "Server gave wrong response to CONFIG: $response\n";
# Line 322 | Line 332 | sub send_tcp_heartbeat() {
332  
333      print $sock "$file_list\n";
334      $response = <$sock>;
335 <    chop $response or return;
335 >    return if (!defined $response);
336 >    chop $response;
337      if (!$response eq "OK") {
338          close($sock);
339          print "Server gave wrong response to file list: $response\n";
# Line 331 | Line 342 | sub send_tcp_heartbeat() {
342      
343      print $sock "$last_modified\n";
344      $response = <$sock>;
345 <    chop $response or return;
345 >    return if (!defined $response);
346 >    chop $response;
347      if ($response eq "ERROR") {
348          close($sock);
349          &tcp_configure();
# Line 344 | Line 356 | sub send_tcp_heartbeat() {
356      }
357      
358      print $sock "ENDHEARTBEAT\n";
359 <    $response = <$sock> or return;
359 >    $response = <$sock>;
360 >    return if (!defined $response);
361      chop $response;
362      if (!$response eq "OK") {
363          close($sock);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines