X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fconnect.pl;h=1f1ad03f640b76f53f1a59f8b1e8aecd678afb5e;hb=89e4fd14125a1eb60cfd9ad2938614083ddaeb67;hp=b3b001819b5067fe49bd0fceeff728f36f7f6cba;hpb=465426f9282b990ec3462c63e5ca7613f92fb290;p=spider.git diff --git a/cmd/connect.pl b/cmd/connect.pl index b3b00181..1f1ad03f 100644 --- a/cmd/connect.pl +++ b/cmd/connect.pl @@ -11,28 +11,23 @@ return (1, $self->msg('already', $call)) if DXChannel->get($call); return (1, $self->msg('outconn', $call)) if grep {$_->{call} eq $call} @main::outstanding_connects; return (1, $self->msg('conscript', $lccall)) unless -e "$main::root/connect/$lccall"; -my $prog = "$main::root/local/client.pl"; -$prog = "$main::root/perl/client.pl" if ! -e $prog; - -my $pid = fork(); -if (defined $pid) { - if (!$pid) { - # in child, unset warnings, disable debugging and general clean up from us - $^W = 0; - $SIG{HUP} = 'IGNORE'; - eval "{ package DB; sub DB {} }"; - alarm(0); - DXChannel::closeall(); - Msg::close_server(); - $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; - exec $prog, $call, 'connect'; - } else { - sleep(1); # do a coordination - push @main::outstanding_connects, {call => $call, pid => $pid}; - return(1, $self->msg('constart', $call)); - } +my $user = DXUser->get($call); +return (1, $self->msg('lockout', $call)) if $user && $user->lockout; + +my @out; +push @out, $self->msg('constart', $call); +my $fn = "$main::root/connect/$lccall"; + +my $f = new IO::File $fn; +if ($f) { + my @f = <$f>; + $f->close; + ExtMsg::start_connect($call, @f); +} else { + push @out, $self->msg('e3', 'connect', $fn); } -return (0, $self->msg('confail', $call, $!)) +return (1, @out); +