X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fconnect.pl;h=fd893974bb3673dfd87b921f1833afc7749a5a0d;hb=ab811a0c902225075a9bd69749f65594079433a9;hp=df9a42389c73dc38400c0b8f4b12dd3904855da0;hpb=5d197c9f7aa2ea796d86aa5473f93956b24cf1b7;p=spider.git diff --git a/cmd/connect.pl b/cmd/connect.pl index df9a4238..fd893974 100644 --- a/cmd/connect.pl +++ b/cmd/connect.pl @@ -5,31 +5,20 @@ my $self = shift; my $call = uc shift; my $lccall = lc $call; -return (0) if $self->priv < 8; +return (1, $self->msg('e5')) if $self->priv < 5; return (1, $self->msg('e6')) unless $call gt ' '; -return (1, $self->msg('already', $call)) if DXChannel->get($call); +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 $user = DXUser::get($call); +return (1, $self->msg('lockout', $call)) if $user && $user->lockout; + +my @out; +push @out, $self->msg('constart', $call); +ExtMsg::start_connect($call, "$main::root/connect/$lccall"); +return (1, @out); -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(); - $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; - exec $prog, $call, 'connect'; - } else { - sleep(1); # do a coordination - return(1, $self->msg('constart', $call)); - } -} -return (0, $self->msg('confail', $call, $!))