summaryrefslogtreecommitdiffstats
path: root/qooxdoo
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2008-06-09 23:57:38 +0200
committerTobi Oetiker <tobi@oetiker.ch>2008-06-09 23:57:38 +0200
commit0ac7fb08ce9b39e0ff02435bb413720050021569 (patch)
tree6c062c7f3fe884b6424527abedb4ff2fab02d9e9 /qooxdoo
parent129d59bc63a690e750a0e4f55ee8389495e2882a (diff)
downloadsmokeping-0ac7fb08ce9b39e0ff02435bb413720050021569.tar.gz
smokeping-0ac7fb08ce9b39e0ff02435bb413720050021569.tar.xz
let the server only return if he has something to say.
Diffstat (limited to 'qooxdoo')
-rw-r--r--qooxdoo/source/perl/Qooxdoo/Services/Tr.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm b/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm
index 1d7e192..a8e3c10 100644
--- a/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm
+++ b/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm
@@ -23,7 +23,7 @@ sub launch {
}
chdir '/' or die "Can't chdir to /: $!";
- $|++; # unbuffer
+# $|++; # unbuffer
open STDOUT, ">>/tmp/tr_session.$$"
or die "Can't write to /tmp/tr_session.$$: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
@@ -109,13 +109,11 @@ sub method_run_tr
# print STDERR "$again, $handle, $size, $point\n";
$rounds ++;
} while ($again and $point >= $size);
+ print STDERR "$point > $size\n";
if (seek $fh, $point,0){
while (<$fh>){
-# print STDERR $_;
- waitpid($handle,WNOHANG);
- /^traceroute to/ && next;
- last unless /\n$/; # stop when we find an incomplete line
- chomp;
+ #print STDERR ">$_<";
+ next if /^\s*$/ or /traceroute to/;
if (/^\s*(\d+)\s+(\S+)\s+\((\S+?)\)\s+(\S+)\s+ms/){
my ($hop,$host,$ip,$value) = ($1,$2,$3,$4);
$value = undef unless $value =~ /^\d+(\.\d+)?$/;
@@ -127,10 +125,12 @@ sub method_run_tr
elsif (/^SLEEP\s+(\d+)/){
push @array, ['SLEEP',$1];
}
- else {
- s/traceroute:\s*//g;
+ elsif (s/traceroute:\s*//g or /\n$/){
push @array, ['INFO',$_];
}
+ else {
+ last;
+ }
$point = tell($fh);
};
close $fh;