use DXChannel;
use DXUser;
use DXM;
-use DXCluster;
use DXProtVars;
use DXProtout;
use DXDebug;
use strict;
use vars qw(%work @msg $msgdir %valid %busy $maxage $last_clean
@badmsg @swop $swopfn $badmsgfn $forwardfn @forward $timeout $waittime
- $queueinterval $lastq $importfn $minchunk $maxchunk);
+ $queueinterval $lastq $importfn $minchunk $maxchunk $bulltopriv);
%work = (); # outstanding jobs
@msg = (); # messages we have
$minchunk = 4800; # minimum chunk size for a split message
$maxchunk = 6000; # maximum chunk size
+$bulltopriv = 1; # convert msgs with callsigns to private if they are bulls
+
$badmsgfn = "$msgdir/badmsg.pl"; # list of TO address we wont store
$forwardfn = "$msgdir/forward.pl"; # the forwarding table
$self->{'read'} = shift;
$self->{rrreq} = shift;
$self->{gotit} = [];
- $self->{lastt} = $main::systime;
+# $self->{lastt} = $main::systime;
$self->{lines} = [];
+ $self->{private} = 1 if $bulltopriv && DXUser->get_current($self->{to});
return $self;
}
if ($main::systime >= $lastq + $queueinterval) {
- # wander down the work queue stopping any messages that have timed out
- for (keys %busy) {
- my $node = $_;
- my $ref = $busy{$_};
- if (exists $ref->{lastt} && $main::systime >= $ref->{lastt} + $timeout) {
- dbg('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
- Log('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
- $ref->stop_msg($node);
-
- # delay any outgoing messages that fail
- $ref->{waitt} = $main::systime + $waittime + rand(120) if $node ne $main::mycall;
- }
- }
-
# queue some message if the interval timer has gone off
queue_msg(0);
dbg('msg', "queue msg ($sort)\n");
my @nodelist = DXChannel::get_all_nodes;
foreach $ref (@msg) {
- # firstly, is it private and unread? if so can I find the recipient
- # in my cluster node list offsite?
# ignore 'delayed' messages until their waiting time has expired
if (exists $ref->{waitt}) {
delete $ref->{waitt};
}
+ # any time outs?
+ if (exists $ref->{lastt} && $main::systime >= $ref->{lastt} + $timeout) {
+ my $node = $ref->{tonode};
+ dbg('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
+ Log('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
+ $ref->stop_msg($node);
+
+ # delay any outgoing messages that fail
+ $ref->{waitt} = $main::systime + $waittime + rand(120) if $node ne $main::mycall;
+ delete $ref->{lastt};
+ next;
+ }
+
+ # firstly, is it private and unread? if so can I find the recipient
+ # in my cluster node list offsite?
+
# deal with routed private messages
my $dxchan;
if ($ref->{private}) {
next if $ref->{'read'}; # if it is read, it is stuck here
- $clref = DXCluster->get_exact($ref->{to});
- unless ($clref) { # otherwise look for a homenode
- my $uref = DXUser->get_current($ref->{to});
- my $hnode = $uref->homenode if $uref;
- $clref = DXCluster->get_exact($hnode) if $hnode;
- }
- if ($clref && !grep { $clref->dxchan == $_ } DXCommandmode::get_all()) {
- next if $clref->call eq $main::mycall; # i.e. it lives here
+ $clref = Route::get($ref->{to});
+# unless ($clref) { # otherwise look for a homenode
+# my $uref = DXUser->get_current($ref->{to});
+# my $hnode = $uref->homenode if $uref;
+# $clref = Route::Node::get($hnode) if $hnode;
+# }
+ if ($clref) {
$dxchan = $clref->dxchan;
- $ref->start_msg($dxchan) if $dxchan && !get_busy($dxchan->call) && $dxchan->state eq 'normal';
+ if ($dxchan) {
+ if ($dxchan->is_node) {
+ next if $clref->call eq $main::mycall; # i.e. it lives here
+ $ref->start_msg($dxchan) if !get_busy($dxchan->call) && $dxchan->state eq 'normal';
+ }
+ } else {
+ dbg('route', "Route: No dxchan for $ref->{to} " . ref($clref) );
+ }
}
}