--- loncom/lonnet/perl/lonnet.pm 2007/03/17 04:11:51 1.849 +++ loncom/lonnet/perl/lonnet.pm 2007/03/27 19:38:39 1.850 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.849 2007/03/17 04:11:51 albertel Exp $ +# $Id: lonnet.pm,v 1.850 2007/03/27 19:38:39 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -144,6 +144,20 @@ sub logperm { return 1; } +sub create_connection { + my ($server) = @_; + my $client=IO::Socket::UNIX->new(Peer =>"/home/httpd/sockets/common", + Type => SOCK_STREAM, + Timeout => 10); + return 0 if (!$client); + print $client ("$server\n"); + my $result = <$client>; + chomp($result); + return 1 if ($result eq 'done'); + return 0; +} + + # -------------------------------------------------- Non-critical communication sub subreply { my ($cmd,$server)=@_; @@ -170,8 +184,10 @@ sub subreply { Timeout => 10); if($client) { last; # Connected! + } else { + &create_connection(&hostname($server)); } - sleep(1); # Try again later if failed connection. + sleep(1); # Try again later if failed connection. } my $answer; if ($client) {