X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fconnect.pl;h=b3b001819b5067fe49bd0fceeff728f36f7f6cba;hb=d00f3cc95cdd280135717d752fc2dcae42616712;hp=7fb3b7f4cc40789039ad6186e862abb4e9637bc7;hpb=8a0f0fc3c54895f0ce8b0207e42af1f693d757f6;p=spider.git diff --git a/cmd/connect.pl b/cmd/connect.pl index 7fb3b7f4..b3b00181 100644 --- a/cmd/connect.pl +++ b/cmd/connect.pl @@ -3,8 +3,13 @@ # my $self = shift; my $call = uc shift; -return (0) if $self->priv < 9; -return (1, $self->msg('already', $call)) if DXChannel::get($call); +my $lccall = lc $call; + +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('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; @@ -12,9 +17,18 @@ $prog = "$main::root/perl/client.pl" if ! -e $prog; my $pid = fork(); if (defined $pid) { if (!$pid) { - # in child + # 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)); } }