X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fclient.pl;h=4a4069f07313c0a6d567bbb14a90e76eb499224d;hb=cc91428ca79b3cdfdc7733505384f5983ad6c7fa;hp=c39bda4c0fbde42c8b1e3890a85773e22be5c960;hpb=97d5445b1e468d9228367640421b2f90ac021224;p=spider.git diff --git a/perl/client.pl b/perl/client.pl index c39bda4c..4a4069f0 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -41,7 +41,6 @@ BEGIN { use Msg; use DXVars; use DXDebug; -use DXUser; use IO::File; use IO::Socket; use IPC::Open2; @@ -110,7 +109,7 @@ sub rec_socket $line =~ s/\n/\r/og if $mode == 1; #my $p = qq($line$snl); if ($buffered) { - if (length $outqueue >= 128) { + if (length $outqueue >= $client_buffer_lth) { print $stdout $outqueue; $outqueue = ""; } @@ -128,7 +127,8 @@ sub rec_socket $mode = $line; # set echo mode from cluster my $term = POSIX::Termios->new; $term->getattr(fileno($sock)); - $term->setflag( &POSIX::ISIG ); + $term->setiflag( 0 ); + $term->setoflag( 0 ); $term->setattr(fileno($sock), &POSIX::TCSANOW ); } } elsif ($sort eq 'I') { @@ -296,12 +296,12 @@ sub timeout $mode = 2; # 1 - \n = \r as EOL, 2 - \n = \n, 0 - transparent $call = ""; # the callsign being used -@stdoutq = (); # the queue of stuff to send out to the user $conn = 0; # the connection object for the cluster $lastbit = ""; # the last bit of an incomplete input line $mynl = "\n"; # standard terminator $lasttime = time; # lasttime something happened on the interface -$outqueue = ""; # the output queue length +$outqueue = ""; # the output queue +$client_buffer_lth = 200; # how many characters are buffered up on outqueue $buffered = 1; # buffer output $savenl = ""; # an NL that has been saved from last time $timeout = 60; # default timeout for connects @@ -317,6 +317,7 @@ $stdout = *STDOUT; $rfh = 0; $wfh = 0; +$waitedpid = 0; # # deal with args @@ -344,6 +345,7 @@ $SIG{'INT'} = \&sig_term; $SIG{'TERM'} = \&sig_term; $SIG{'HUP'} = 'IGNORE'; $SIG{'CHLD'} = \&sig_chld; +$SIG{'ALRM'} = \&timeout; dbgadd('connect'); @@ -359,10 +361,12 @@ if ($loginreq) { close(I); $issue = s/\n/\r/og if $mode == 1; local $/ = $nl; - $stdout->print($issue) if issue; + $stdout->print($issue) if $issue; } + use DXUser; + DXUser->init($userfn); # allow a login from an existing user. I could create a user but @@ -414,7 +418,7 @@ if ($connsort eq "connect") { open(IN, "$cpath/$mcall") or cease(2); @in = ; close IN; - + alarm($timeout); for (@in) { @@ -442,7 +446,7 @@ if ($connsort eq "connect") { # close W; $stdin = $rfh; $stdout = $wfh; - $csort = 'telnet' if $sort eq 'prog'; + $csort = 'telnet' if $csort eq 'prog'; } elsif ($csort eq 'telnet') { # open(STDIN, "<&$sock"); # open(STDOUT, ">&$sock");