}
-my $_isdbg; # current dbg level we are processing
+my $_isdbg = ''; # current dbg level we are processing
sub dbg
{
sub dbgprintring
{
return unless $fp;
- my $count = shift;
+ my $i = shift || 0;
+ my $count = @dbgring;
+ $i = @dbgring-$i if $i;
+ return 0 unless $i < $count; # do nothing if there is nothing to print
+
my $first;
my $l;
- my $i = defined $count ? @dbgring-$count : 0;
- $count = @dbgring;
for ( ; $i < $count; ++$i) {
my ($t, $str) = split /\^/, $dbgring[$i], 2;
next unless $t;
}
my $buf = sprintf "%02d:%02d:%02d", (gmtime($t))[2,1,0];
$fp->writeunix($lt, "$lt^RING: $buf^$str");
+ ++$l;
}
my $et = time;
$fp->writeunix($et, "$et^###");
- $fp->writeunix($et, "$et^### RINGBUFFER END");
+ $fp->writeunix($et, "$et^### RINGBUFFER END $l debug lines written");
$fp->writeunix($et, "$et^###");
+ return $l;
}
sub dbgclearring
if ($call) {
my $ncall = $parent->call;
- if ($is_node) {
- dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
- @rout = $parent->add($call, $version, Route::here($here), $ip);
- my $r = Route::Node::get($call);
- $r->PC92C_dxchan($dxchan->call, $hops) if $r;
- if ($ip) {
- $r->ip($ip);
- Log('DXProt', "PC92A $call -> $ip on $ncall");
+ if ($ncall ne $call) {
+ if ($is_node) {
+ dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
+ @rout = $parent->add($call, $version, Route::here($here), $ip);
+ my $r = Route::Node::get($call);
+ $r->PC92C_dxchan($dxchan->call, $hops) if $r;
+ if ($ip) {
+ $r->ip($ip);
+ Log('DXProt', "PC92A $call -> $ip on $ncall");
+ }
+ } else {
+ dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
+ @rout = $parent->add_user($call, Route::here($here), $ip);
+ $dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
+ my $r = Route::User::get($call);
+ if ($ip) {
+ $r->ip($ip);
+ Log('DXProt', "PC92A $call -> $ip on $ncall");
+ }
}
- } else {
- dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
- @rout = $parent->add_user($call, Route::here($here), $ip);
- $dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
- my $r = Route::User::get($call);
- if ($ip) {
- $r->ip($ip);
- Log('DXProt', "PC92A $call -> $ip on $ncall");
+ if ($pc92_slug_changes && $parent == $main::routeroot) {
+ $things_add{$call} = Route::get($call);
+ delete $things_del{$call};
}
- }
- if ($pc92_slug_changes && $parent == $main::routeroot) {
- $things_add{$call} = Route::get($call);
- delete $things_del{$call};
+ } else {
+ dbgprintring(10);
+ dbg("DXProt::add_thingy: Trying to add parent $call to itself $ncall, ignored");
}
}
+
return @rout;
}
package main;
require 5.10.1;
+
use warnings;
use vars qw($root $is_win $systime $lockfn @inqueue $starttime $lockfn @outstanding_connects
# make sure that modules are searched in the order local then perl
BEGIN {
umask 002;
-
+ $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN };
+
# take into account any local::lib that might be present
eval {
require local::lib;
use DXVars;
use SysVar;
-use strict;
-
# order here is important - DXDebug snarfs Carp et al so that Mojo errors go into the debug log
use DXDebug;
-
use Mojolicious 7.26;
use Mojo::IOLoop;
+$DOWARN = 1;
+
use Msg;
use IntMsg;
use Internet;
use vars qw($version $build $gitversion $gitbranch);
+use strict;
+
use Local;