From 1ede2f2620e6d40f0cadc2b196324e9de9bcd1ce Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Tue, 3 Jun 2008 22:46:38 +0000 Subject: prepping for traceroute switch --- qooxdoo/source/class/Mtr/ui/TraceTable.js | 9 +++++---- qooxdoo/source/perl/Qooxdoo/Services/Mtr.pm | 26 +++++++++++++++----------- qooxdoo/source/translation/messages.pot | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) (limited to 'qooxdoo/source') diff --git a/qooxdoo/source/class/Mtr/ui/TraceTable.js b/qooxdoo/source/class/Mtr/ui/TraceTable.js index 1097f22..dae0a05 100644 --- a/qooxdoo/source/class/Mtr/ui/TraceTable.js +++ b/qooxdoo/source/class/Mtr/ui/TraceTable.js @@ -84,13 +84,14 @@ qx.Class.define('Mtr.ui.TraceTable', } self.__handle = retval['handle']; var tableModel = self.__tableModel; - var rowcount = tableModel.getRowCount(); var lines = retval['output'].length; var data = self.__data; for(var i=0;iset_error(101,"Can't fork: $!");return $error}; if ($pid){ open my $x, ">/tmp/mtr_session.$pid" or do { @@ -25,7 +27,10 @@ sub launch { open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; setsid or die "Can't start a new session: $!"; open STDERR, '>&STDOUT' or die "Can't dup stdout: $!"; - exec @_; + for (my $i = 0; $i<$rounds;$i++){ + system "traceroute","-I","-q","1",$host; + sleep $delay; + } } sub get_number { @@ -64,7 +69,7 @@ sub method_run_mtr return $delay if ref $delay; my $rounds = get_number($error,$arg->{rounds}); return $rounds if ref $rounds; - $handle = launch ($error,"mtr","-4","--raw","--report-cycles=$rounds","--interval=$delay",$arg->{host}); + $handle = launch ($error,$rounds,$delay,$arg->{host}); $point = 0; } return $point if ref $point; @@ -87,22 +92,21 @@ sub method_run_mtr if (seek $fh, $point,0){ my @array; while (<$fh>){ - if (not /^[a-z]\s/){ - waitpid($handle,WNOHANG); - if (/Name or service not known/){ - $error->set_error(108,"Unknown hostname."); - return $error; - } + waitpid($handle,WNOHANG); + if (/unknown host/){ + $error->set_error(108,"Unknown hostname."); + return $error; + } else { $error->set_error(107,"ERROR: $_. See $data for more information."); return $error; } } last unless /\n$/; # stop when we find an incomplete line + /^\s*(\d+)\s+(\S+)\s+\((\S+?)\)\s+(\S+)\s+ms/ or next; + push @array, [$1,$2,$3,$4]; $point = tell($fh); chomp; - my @line = split (/\s+/,$_); - push @array,\@line; }; close $fh; unlink $data unless $again; diff --git a/qooxdoo/source/translation/messages.pot b/qooxdoo/source/translation/messages.pot index e034fed..3686248 100644 --- a/qooxdoo/source/translation/messages.pot +++ b/qooxdoo/source/translation/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-06-02 20:43+0200\n" +"POT-Creation-Date: 2008-06-03 14:17+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -- cgit v1.2.3-24-g4f1b