X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXXml.pm;h=21a2c1653d97fd71bb06853cbb046b049e03b1be;hb=edfc15583881f720a65516d975d26cdb6b7c8469;hp=280d19ced31691e35612880b3b48ee086e297470;hpb=b359511572b5dcd67dc17437e7ce4ca3574eada8;p=spider.git diff --git a/perl/DXXml.pm b/perl/DXXml.pm index 280d19ce..21a2c165 100644 --- a/perl/DXXml.pm +++ b/perl/DXXml.pm @@ -59,16 +59,21 @@ sub init eval { require XML::Parser } unless $@; if ($@) { LogDbg('err', "do_xml was set to 1 and the XML routines failed to load ($@)"); - $main::do_xml = 0; + $main::do_xml = $xs = 0; } else { $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; import XML::Simple; - $DXProt::handle_xml = 1; $xs = new XML::Simple(ContentKey=>'content', ForceArray=>1); } undef $@; } +# is XML avaiable and active +sub available +{ + return $main::do_xml && $xs; +} + # # note that this a function not a method # @@ -77,7 +82,7 @@ sub normal my $dxchan = shift; my $line = shift; - unless ($main::do_xml) { + unless (available()) { dbg("xml not enabled, IGNORED") if isdbg('chanerr'); return; } @@ -156,7 +161,6 @@ sub process DXXml::Ping::add($main::me, $dxchan->call); $dxchan->{nopings} -= 1; $dxchan->{lastping} = $t; - $dxchan->{lastping} += $dxchan->{pingint} / 2 unless @{$dxchan->{pingtime}}; } } } @@ -215,7 +219,7 @@ sub route my $via = $to; my $dxchan; - if (my $u = $self->{u}) { + if (my $u = $self->{u} && $self->{to} eq $main::mycall) { $via ||= $u if ($dxchan = DXChannel::get($u)); } $via ||= $self->{'-via'} || $self->{to};