summaryrefslogtreecommitdiffstats
path: root/qooxdoo/source/perl
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2008-06-05 18:17:11 +0200
committerTobi Oetiker <tobi@oetiker.ch>2008-06-05 18:17:11 +0200
commit9a6c0d09fb7ac906607f5fd2f4ec18d126ee5b72 (patch)
treef8d92db8c8b07ec6ee8497ab83af40eb56182603 /qooxdoo/source/perl
parentf7c8c95ddc80c3b26f0d7978b776e02bc950a9fa (diff)
downloadsmokeping-9a6c0d09fb7ac906607f5fd2f4ec18d126ee5b72.tar.gz
smokeping-9a6c0d09fb7ac906607f5fd2f4ec18d126ee5b72.tar.xz
sleep properly inbetween checks
Diffstat (limited to 'qooxdoo/source/perl')
-rw-r--r--qooxdoo/source/perl/Qooxdoo/Services/Tr.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm b/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm
index 0cf88b3..1d7e192 100644
--- a/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm
+++ b/qooxdoo/source/perl/Qooxdoo/Services/Tr.pm
@@ -22,6 +22,8 @@ sub launch {
return $pid;
}
chdir '/' or die "Can't chdir to /: $!";
+
+ $|++; # 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: $!";
@@ -31,7 +33,7 @@ sub launch {
my $start = time;
system "traceroute","-I","-q","1",$host;
my $wait = $delay - (time - $start);
- if ($wait > 0){
+ if ($wait > 0 and $i+1< $rounds){
print "SLEEP $wait\n";
sleep $wait;
}
@@ -109,6 +111,7 @@ sub method_run_tr
} while ($again and $point >= $size);
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