X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fclient.pl;h=459c26323a34480131247918043d9124649962dd;hb=e6a53556f10b5d2f831dcd7b83655430c9b1a137;hp=2e6a4f1727452652d1b32f3ccf7353e2016cedd9;hpb=e0278322b79d09a997ed7df948c57b58f02b139c;p=spider.git diff --git a/perl/client.pl b/perl/client.pl index 2e6a4f17..459c2632 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -41,10 +41,10 @@ BEGIN { use Msg; use DXVars; use DXDebug; +use Net::Telnet qw(TELOPT_ECHO); use IO::File; use IO::Socket; use IPC::Open2; -use Net::Telnet qw(TELOPT_ECHO); use Carp qw{cluck}; # cease communications @@ -209,12 +209,13 @@ sub doconnect $port = 23 if !$port; # if ($port == 23) { + $sock = new Net::Telnet (Timeout => $timeout, Port => $port); $sock->option_callback(\&optioncb); $sock->output_record_separator(''); - $sock->option_log('option_log'); - $sock->dump_log('dump'); - $sock->option_accept(Wont => TELOPT_ECHO); +# $sock->option_log('option_log'); +# $sock->dump_log('dump'); + $sock->option_accept(Dont => TELOPT_ECHO, Wont => TELOPT_ECHO); $sock->open($host) or die "Can't connect to $host port $port $!"; # } else { # $sock = IO::Socket::INET->new(PeerAddr => "$host:$port", Proto => 'tcp') @@ -269,6 +270,10 @@ sub dochat $line = <$rfh>; $line =~ s/\r//og; } + if (length $line == 0) { + dbg('connect', "received 0 length line, aborting..."); + cease(11); + } dbg('connect', "received \"$line\""); if ($abort && $line =~ /$abort/i) { dbg('connect', "aborted on /$abort/"); @@ -492,7 +497,7 @@ Msg->set_event_handler($stdin, "read" => \&rec_stdin); for (;;) { my $t; - Msg->event_loop(1, 0.010); + Msg->event_loop(1, 1); $t = time; if ($t > $lasttime) { if ($outqueue) {