X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCommandmode.pm;h=f43993c48c5a63102ad6dd2adf9d41863152eb1c;hb=dbeecf2c5b0e87c38b52edf992d41b122a676fcd;hp=1dd868c0aa79600c371307b1224513decb25e492;hpb=c480ac94da7dbd5762fcd15aa556c874d223e14e;p=spider.git diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 1dd868c0..f43993c4 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -42,9 +42,10 @@ use AsyncMsg; use JSON; use Time::HiRes qw(gettimeofday tv_interval); +use Mojo::UserAgent; use Mojo::IOLoop; use Mojo::IOLoop::Subprocess; -use Mojo::UserAgent; +use DXSubprocess; use strict; use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase %nothereslug @@ -139,6 +140,9 @@ sub start $self->{here} = 1; $self->{prompt} = $user->prompt if $user->prompt; $self->{lastmsgpoll} = 0; + $self->{rbn} = $user->wantrbn; + $self->{ft} = $user->wantft; + $self->{cw} = $user->wantcw; # sort out new dx spot stuff $user->wantdxcq(0) unless defined $user->{wantdxcq}; @@ -547,13 +551,13 @@ sub run_cmd my $t0 = [gettimeofday]; eval { @ans = &{"${package}::handle"}($self, $args) }; if ($@) { - dbgprintring(25); + DXDebug::dbgprintring(25); return (DXDebug::shortmess($@)); } if (isdbg('progress')) { my $msecs = _diffms($t0); my $s = "CMD: '$cmd $args' by $call ip: $self->{hostname} ${msecs}mS"; - dbg($s); + dbg($s) if $cmd !~ /^(?:echo|blank)/ || isdbg('echo'); # cut down a bit on HRD and other clients' noise } } else { dbg("cmd: $package not present") if isdbg('command'); @@ -1316,14 +1320,14 @@ sub spawn_cmd return @out; } - my $fc = Mojo::IOLoop::Subprocess->new; + my $fc = DXSubprocess->new; # $fc->serializer(\&encode_json); # $fc->deserializer(\&decode_json); $fc->run( sub { my $subpro = shift; - if (isdbg('progress')) { - my $s = qq{line: "$line"}; + if (isdbg('spawn')) { + my $s = __PACKAGE__ . qq{ line: "$line"}; $s .= ", args: " . join(', ', map { defined $_ ? qq{'$_'} : q{'undef'} } @$args) if $args && @$args; dbg($s); } @@ -1357,7 +1361,7 @@ sub spawn_cmd $dxchan->send(@res); } } - diffms("by $call", $line, $t0, scalar @res) if isdbg('progress'); + diffms(__PACKAGE__, "by $call", $line, $t0, scalar @res) if isdbg('progress'); }); return @out;