From 17ad5480c740a4949f94e357139703c728a167d4 Mon Sep 17 00:00:00 2001
From: minima <minima>
Date: Tue, 13 Mar 2001 20:36:23 +0000
Subject: [PATCH] alter dup channel connected logic add peerhost to who

---
 Changes         | 1 +
 cmd/who.pl      | 8 +++++---
 perl/cluster.pl | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Changes b/Changes
index 549e49d8..6ee6f6d7 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 13Mar01=======================================================================
 1. implemented first cut at non blocking connect
 2. removed memory leakage in connects
+3. add link IP address if available on who
 10Mar01=======================================================================
 1. minor changes to the admin manual to reflect differences in distibutions
 thanks to pa3ezl (g0vgs)
diff --git a/cmd/who.pl b/cmd/who.pl
index 8bd69e80..1ccf9ca8 100644
--- a/cmd/who.pl
+++ b/cmd/who.pl
@@ -11,7 +11,7 @@ my $self = shift;
 my $dxchan;
 my @out;
 
-push @out, "  Callsign Type      Started           Name                Ave RTT";
+push @out, "  Callsign Type      Started           Name     Ave RTT Link";
 
 foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) {
     my $call = $dxchan->call();
@@ -26,8 +26,10 @@ foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) {
 		$sort = "AK1A" if $dxchan->is_ak1a;
 	}
 	my $name = $dxchan->user->name || " ";
-	my $ping = $dxchan->is_node && $dxchan != $DXProt::me ? sprintf("%8.2f", $dxchan->pingave) : "";
-	push @out, sprintf "%10s $type $sort $t %-18.18s $ping", $call, $name;
+	my $ping = $dxchan->is_node && $dxchan != $DXProt::me ? sprintf("%5.2f", $dxchan->pingave) : "     ";
+	my $conn = $dxchan->conn;
+	my $ip = $conn->{peerhost} || '' if $conn;
+	push @out, sprintf "%10s $type $sort $t %-10.10s $ping $ip", $call, $name;
 }
 
 return (1, @out)
diff --git a/perl/cluster.pl b/perl/cluster.pl
index e062b65e..181e3054 100755
--- a/perl/cluster.pl
+++ b/perl/cluster.pl
@@ -115,7 +115,8 @@ sub new_channel
 	# set up the basic channel info
 	# is there one already connected to me - locally? 
 	my $user = DXUser->get($call);
-	if ($sort ne 'O' && Msg->conns($call)) {
+	my $dxchan = DXChannel->get($call);
+	if ($dxchan) {
 		my $mess = DXM::msg($lang, ($user && $user->is_node) ? 'concluster' : 'conother', $call, $main::mycall);
 		already_conn($conn, $call, $mess);
 		return;
@@ -150,7 +151,6 @@ sub new_channel
 	}
 
 	# create the channel
-	my $dxchan;
 	$dxchan = DXCommandmode->new($call, $conn, $user) if $user->is_user;
 	$dxchan = DXProt->new($call, $conn, $user) if $user->is_node;
 	$dxchan = BBS->new($call, $conn, $user) if $user->is_bbs;
-- 
2.43.0