diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2007-08-30 17:16:53 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2007-08-30 17:16:53 +0000 |
| commit | 0454db1003d8c0314f05f4c5491b61f4bbbd8ff7 (patch) | |
| tree | d21f3f24f9a0df4d3d0a6ef6df5fc16c9b83d1c2 /lib | |
| parent | be8c52fbac04ede51b7c3e353106d66cd15df681 (diff) | |
| download | xxv-0454db1003d8c0314f05f4c5491b61f4bbbd8ff7.tar.gz xxv-0454db1003d8c0314f05f4c5491b61f4bbbd8ff7.tar.bz2 | |
* Bugfix: Handle SVDRP better if connection blocked
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/XXV/MODULES/SVDRP.pm | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/XXV/MODULES/SVDRP.pm b/lib/XXV/MODULES/SVDRP.pm index 90fc341..ab29434 100644 --- a/lib/XXV/MODULES/SVDRP.pm +++ b/lib/XXV/MODULES/SVDRP.pm @@ -146,12 +146,13 @@ sub command { # read first line do { $line = $telnet->getline; - last unless $line; - chomp($line); - push(@$data, $line); - } while($line =~ /^\d\d\d\-/); + chomp($line) if($line); + if($line) { + push(@$data, $line); + } + } while($line && $line =~ /^\d\d\d\-/); - unless(scalar @$data){ + unless($data && scalar @$data){ error sprintf("Couldn't read data from svdrp-socket %s:%s! %s",$host,$port,$telnet ? $telnet->errmsg : $!); return undef; } @@ -170,17 +171,18 @@ sub command { # read response do { $line = $telnet->getline; - last unless $line; - chomp($line); + chomp($line) if($line); + if($line) { - if($line =~ /^(\d{3})\s+(.+)/ && (int($1) >= 500)) { - my $msg = sprintf("Error at command '%s' to %s:%s! %s", $command,$host,$port, $2); - error($msg); - $obj->{ERROR} .= $msg . "\n"; - } + if($line =~ /^(\d{3})\s+(.+)/ && (int($1) >= 500)) { + my $msg = sprintf("Error at command '%s' to %s:%s! %s", $command,$host,$port, $2); + error($msg); + $obj->{ERROR} .= $msg . "\n"; + } - push(@$data, $line); - } while($line =~ /^\d\d\d\-/); + push(@$data, $line); + } + } while($line && $line =~ /^\d\d\d\-/); } # close socket |
