improve the fix slightly to avoid false positives
[spider.git] / perl / DXProtHandle.pm
index 9a4104e5c8ad70d4d4f81bacef83fc4ea3a8e746..16623045ba106afef6b63272e5cdad006ad522e5 100644 (file)
@@ -1560,12 +1560,14 @@ sub handle_92
                                                dbg("PCPROT: $call looped back onto $main::mycall, ignored") if isdbg('chanerr');
                                                return;
                                        }
+                                       # this is only accepted from my "self".
+                                       # this also kills configs from PC92 nodes with external PC19 nodes that are also
+                                       # locally connected. Local nodes always take precedence.
+                                       if (DXChannel::get($call) && $call ne $self->{call}) {
+                                               dbg("PCPROT: locally connected node $call from other another node $self->{call}, ignored") if isdbg('chanerr');
+                                               return;
+                                       }
                                        if ($is_extnode) {
-                                               # this is only accepted from my "self"
-                                               if (DXChannel::get($call) && $call ne $self->{call}) {
-                                                       dbg("PCPROT: locally connected node config for $call from other another node $self->{call}, ignored") if isdbg('chanerr');
-                                                       return;
-                                               }
                                                # reparent to external node (note that we must have received a 'C' or 'A' record
                                                # from the true parent node for this external before we get one for the this node
                                                unless ($parent = Route::Node::get($call)) {
@@ -1736,9 +1738,16 @@ sub handle_93
                my $dxchan;
                $dxchan = DXChannel::get($main::myalias) if $to eq $main::mycall;
                $dxchan = DXChannel::get($to) unless $dxchan;
-               if ($dxchan && $dxchan->is_user) {
-                       $dxchan->talk($from, $to, $via, $text, $onode);
-                       return;
+               # check it...
+               if ($dxchan) {
+                       if (ref $dxchan && $dxchan->isa('DXChannel')) {
+                               if ($dxchan->is_user) {
+                                       $dxchan->talk($from, $to, $via, $text, $onode);
+                                       return;
+                               }
+                       } else {
+                               dbg("ERROR: $to -> $dxchan is not a DXChannel! (local talk)");
+                       }
                }
 
                # convert to PC10 talks where appropriate
@@ -1746,14 +1755,17 @@ sub handle_93
                if ($ref) {
                        # just go for the "best" one for now (rather than broadcast)
                        $dxchan = $ref->dxchan;
-#                      my @dxchan = $ref->alldxchan;
-#                      for $dxchan (@dxchan) {
+
+                       # check it...
+                       if (ref $dxchan && $dxchan->isa('DXChannel')) {
                                if ($dxchan->{do_pc9x}) {
                                        $dxchan->send($line);
                                } else {
                                        $dxchan->talk($from, $to, $via, $text, $onode);
                                }
-#                      }
+                       } else {
+                               dbg("ERROR: $to -> $dxchan is not a DXChannel! (convert to pc10)");
+                       }
                        return;
                }