From c02dc2d8b544b9d682c9a068ba13bdedf40ed3bf Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Sat, 13 Mar 2010 19:41:54 +0000 Subject: [PATCH] add more fixes for peerhosts --- Changes | 1 + perl/AGWMsg.pm | 2 +- perl/BPQMsg.pm | 7 +++++++ perl/DXCommandmode.pm | 2 +- perl/EphMsg.pm | 2 +- perl/ExtMsg.pm | 4 ++-- perl/Msg.pm | 17 +++++++++++------ perl/UDPMsg.pm | 7 +++++++ perl/Version.pm | 2 +- 9 files changed, 32 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index 261fb369..e1a02d80 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ 13Mar10======================================================================= 1. try to fix AGW crashes caused by peerhost looking at the wrong thing. +2. Add more ax25 fixes for peerhost 03Mar10======================================================================= 1. add IP addresses to connecting PC92 A addresses and log them 2. add CTY-2002 prefixes diff --git a/perl/AGWMsg.pm b/perl/AGWMsg.pm index 76b80fde..910d32cc 100644 --- a/perl/AGWMsg.pm +++ b/perl/AGWMsg.pm @@ -412,7 +412,7 @@ sub _find sub peerhost { my $conn = shift; - $conn->{peerhost} ||= $conn->{agwcall} || "UNKNOWN"; + $conn->{peerhost} ||= 'ax25'; return $conn->{peerhost}; } diff --git a/perl/BPQMsg.pm b/perl/BPQMsg.pm index e5ca7077..e95ae399 100644 --- a/perl/BPQMsg.pm +++ b/perl/BPQMsg.pm @@ -134,6 +134,13 @@ sub active return $Buffers; } +sub peerhost +{ + my $conn = shift; + $conn->{peerhost} ||= 'ax25'; + return $conn->{peerhost}; +} + sub connect { diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 87182fc6..79835177 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -1224,7 +1224,7 @@ sub send_motd } $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd; $motd = $main::motd unless $motd && -e $motd; - if ($self->conn->{csort} eq 'ax25') { + if ($self->conn->ax25) { if ($motd) { $motd = "${motd}_ax25" if -e "${motd}_ax25"; } else { diff --git a/perl/EphMsg.pm b/perl/EphMsg.pm index 0814df84..a6da8a2d 100644 --- a/perl/EphMsg.pm +++ b/perl/EphMsg.pm @@ -45,7 +45,7 @@ sub dequeue my $conn = shift; my $msg; - if ($conn->{csort} eq 'ax25' && exists $conn->{msg}) { + if ($conn->ax25 && exists $conn->{msg}) { $conn->{msg} =~ s/\cM/\cJ/g; } diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index 0ca2de83..a84b598a 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -72,7 +72,7 @@ sub dequeue my $conn = shift; my $msg; - if ($conn->{csort} eq 'ax25' && exists $conn->{msg}) { + if ($conn->ax25 && exists $conn->{msg}) { $conn->{msg} =~ s/\cM/\cJ/g; } if ($conn->{state} eq 'WC') { @@ -153,7 +153,7 @@ sub to_connected delete $conn->{cmd}; $conn->{timeout}->del if $conn->{timeout}; delete $conn->{timeout}; - $conn->nolinger unless $conn->isa('AGWMsg') || $conn->isa('BPQMsg'); + $conn->nolinger unless $conn->ax25; &{$conn->{rproc}}($conn, "$dir$call|$sort"); $conn->_send_file("$main::data/connected") unless $conn->{outgoing}; } diff --git a/perl/Msg.pm b/perl/Msg.pm index 531bff73..f2bb2976 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -193,14 +193,19 @@ sub pid_gone } } +sub ax25 +{ + my $conn = shift; + return $conn->{csort} eq 'ax25'; +} + sub peerhost { - my $self = shift; - my $ip; - unless ($self->{peerhost}) { - $self->{peerhost} = $self->{sock}->peerhost; - } - return $self->{peerhost}; + my $conn = shift; + $conn->{peerhost} ||= 'ax25' if $conn->ax25; + $conn->{peerhost} ||= $conn->{sock}->peerhost if $conn->{sock} && $conn->{sock}->isa('IO::Socket::INET'); + $conn->{peerhost} ||= 'UNKNOWN'; + return $conn->{peerhost}; } #----------------------------------------------------------------- diff --git a/perl/UDPMsg.pm b/perl/UDPMsg.pm index 566f0210..b7241f91 100644 --- a/perl/UDPMsg.pm +++ b/perl/UDPMsg.pm @@ -201,6 +201,13 @@ sub _find return $circuit{$call}; } +sub peerhost +{ + my $conn = shift; + $conn->{peerhost} ||= 'ax25'; + return $conn->{peerhost}; +} + sub connect { my ($conn, $line) = @_; diff --git a/perl/Version.pm b/perl/Version.pm index 42f6c129..66456c43 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.55'; $subversion = '0'; -$build = '63'; +$build = '64'; 1; -- 2.43.0