diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2008-06-04 00:46:38 +0200 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2008-06-04 00:46:38 +0200 |
commit | 1ede2f2620e6d40f0cadc2b196324e9de9bcd1ce (patch) | |
tree | c02b14d5bca780abd7977754a38ba392b6a0f44b /qooxdoo | |
parent | 9c59d668c6d0611f1ea611ca0e9ea5a5954eaa20 (diff) | |
download | smokeping-1ede2f2620e6d40f0cadc2b196324e9de9bcd1ce.tar.gz smokeping-1ede2f2620e6d40f0cadc2b196324e9de9bcd1ce.tar.xz |
prepping for traceroute switch
Diffstat (limited to 'qooxdoo')
-rw-r--r-- | qooxdoo/source/class/Mtr/ui/TraceTable.js | 9 | ||||
-rw-r--r-- | qooxdoo/source/perl/Qooxdoo/Services/Mtr.pm | 26 | ||||
-rw-r--r-- | qooxdoo/source/translation/messages.pot | 2 |
3 files changed, 21 insertions, 16 deletions
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;i<lines;i++){ - var cmd = retval['output'][i][0]; - var row = retval['output'][i][1]; - var value = retval['output'][i][2]; + var hop = retval['output'][i][0]; + var host = retval['output'][i][1]; + var ip = retval['output'][i][2]; + var rtt = retval['output'][i][3]; + for(var ii=hop;data[ii][0]<hop if (rowcount <= row){ for (var ii=rowcount;rowcount <= row;rowcount++){ data.push(self.__make_empty_row()); diff --git a/qooxdoo/source/perl/Qooxdoo/Services/Mtr.pm b/qooxdoo/source/perl/Qooxdoo/Services/Mtr.pm index 6aead46..6b1b746 100644 --- a/qooxdoo/source/perl/Qooxdoo/Services/Mtr.pm +++ b/qooxdoo/source/perl/Qooxdoo/Services/Mtr.pm @@ -9,7 +9,9 @@ sub GetAccessibility { sub launch { my $error = shift; - $SIG{CHLD} = \&REAPER; + my $rounds = shift; + my $delay = shift; + my $host = shift; defined(my $pid = fork) or do { $error->set_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 <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" |