From: Graham Barr Date: Tue, 2 Apr 2002 14:27:37 +0000 (+0000) Subject: Sync with libnet-1.11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=67ada6d4c0aefe0492b64bb49347c0a35400caaa;p=p5sagit%2Fp5-mst-13.2.git Sync with libnet-1.11 p4raw-id: //depot/perl@15679 --- diff --git a/lib/Net/ChangeLog.libnet b/lib/Net/ChangeLog.libnet index 2ef21ac..60d06ff 100644 --- a/lib/Net/ChangeLog.libnet +++ b/lib/Net/ChangeLog.libnet @@ -1,3 +1,16 @@ +Change 716 on 2002/04/02 by (Graham Barr) + + Net::FTP::dataconn + - Fix for select to avoid occasional hangups + +Change 715 on 2002/04/02 by (Graham Barr) + + Tweak parsing of hello response + +Change 706 on 2002/02/28 by (Graham Barr) + + Release 1.10 + Change 705 on 2002/02/28 by (Graham Barr) Net::FTP::I diff --git a/lib/Net/FTP/dataconn.pm b/lib/Net/FTP/dataconn.pm index 6ca437b..7ec1458 100644 --- a/lib/Net/FTP/dataconn.pm +++ b/lib/Net/FTP/dataconn.pm @@ -7,8 +7,9 @@ package Net::FTP::dataconn; use Carp; use vars qw(@ISA $timeout $VERSION); use Net::Cmd; +use Errno; -$VERSION = '0.10'; +$VERSION = '0.11'; @ISA = qw(IO::Socket::INET); sub reading @@ -74,44 +75,34 @@ sub close $ftp->status == CMD_OK; } -sub _select -{ - my $data = shift; - local *timeout = \$_[0]; shift; - my $rw = shift; - - my($rin,$win); - - return 1 unless $timeout; +sub _select { + my ($data, $timeout, $do_read) = @_; + my ($rin,$rout,$win,$wout,$tout,$nfound); - $rin = ''; - vec($rin,fileno($data),1) = 1; + vec($rin='',fileno($data),1) = 1; - $win = $rw ? undef : $rin; - $rin = undef unless $rw; + ($win, $rin) = ($rin, $win) unless $do_read; - my $nfound = select($rin, $win, undef, $timeout); + while (1) { + $nfound = select($rout=$rin, $wout=$win, undef, $tout=$timeout); - croak "select: $!" - if $nfound < 0; + last if $nfound >= 0; + + croak "select: $!" + unless $!{EINTR}; + } - return $nfound; + $nfound; } sub can_read { - my $data = shift; - local *timeout = \$_[0]; - - $data->_select($timeout,1); + _select(@_[0,1],1); } sub can_write { - my $data = shift; - local *timeout = \$_[0]; - - $data->_select($timeout,0); + _select(@_[0,1],0); } sub cmd diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm index e76863d..5412c17 100644 --- a/lib/Net/SMTP.pm +++ b/lib/Net/SMTP.pm @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.21"; # $Id: //depot/libnet/Net/SMTP.pm#22 $ +$VERSION = "2.22"; # $Id: //depot/libnet/Net/SMTP.pm#23 $ @ISA = qw(Net::Cmd IO::Socket::INET); @@ -132,7 +132,7 @@ sub hello my $ln; foreach $ln (@msg) { $h->{uc $1} = $2 - if $ln =~ /(\S+)\b[ \t]*([^\n]*)/; + if $ln =~ /(\w+)\b[= \t]*([^\n]*)/; } } elsif($me->status == CMD_ERROR) @@ -647,6 +647,6 @@ it under the same terms as Perl itself. =for html
-I<$Id: //depot/libnet/Net/SMTP.pm#22 $> +I<$Id: //depot/libnet/Net/SMTP.pm#23 $> =cut